Skip to content

Diagnostics

Routa validates the route graph before TypeScript runs, so contract mistakes surface as named codes instead of deep inference errors. Every command that touches a project — check, generate, build, routes, dev, start, and both openapi subcommands — runs the same validation and reports the same codes.

Diagnostics are printed as the code, the file, the message, and a suggestion:

ROUTA_MIDDLEWARE_ORDER: src/routes/admin/middleware.ts: withAdmin requires ctx.auth before it is provided.
Suggestion: Move middleware that provides auth before withAdmin.

Only error diagnostics fail the command. Any error exits with code 1, and no metadata is written. A warning is printed with a Warning: prefix and does not fail the command or block the metadata write:

Warning: ROUTA_SCHEMA_OPAQUE_INPUT: src/routes/imports/schemas.ts: z.preprocess() accepts input Routa cannot describe, so OpenAPI documents the schema after preprocessing: z.preprocess(...)
Suggestion: Parse the incoming value with a declarative schema first, then use .transform() or .pipe() to change it.

A required file or directory is missing: package.json, tsconfig.json, src/, or src/routa.ts.

Fix: run the command from the project root. If you are adding Routa to an existing project, create src/routa.ts with a default createRouta() export.

The route file has no default export that Routa can statically resolve to a createRouteRoot(path) result.

Fix: export the helper call directly. Routa analyzes source without executing it, so building the config through a variable, a function, or a conditional cannot be resolved.

// Resolvable
export default route({ get: createRoute({ /* ... */ }) });

Two route files resolve to the same URL path. The usual cause is a directory-style file and a flat-style file describing the same path.

Fix: rename or move one of them. The message names both files.

Two operations would generate the same OpenAPI operationId. Routa names each operation from its method plus the path in PascalCase, treating every run of punctuation as a word break, so GET /users/:id and GET /users/id both become getUsersId.

Fix: change a path segment so the two routes differ by more than punctuation or parameter syntax, for example /users/:id and /users/by-name. Routa does not rename an operationId to make it unique.

A route file declares an options method.

Fix: remove it. Routa generates OPTIONS for every path and keeps its Allow header in sync with the declared methods.

A method declares no response with a 2xx status.

Fix: add one. 204 counts, which is the usual answer for DELETE.

An outcome uses a 1xx status. Informational statuses are not final responses, so they cannot be terminal route outcomes.

Fix: use a final status from 200 to 599.

An outcome declares a schema but its status is 204, 205, or 304, or it belongs to a HEAD route. None of those responses has a body. A middleware reject reachable from a HEAD route reports this too, at the route file.

Fix: remove the schema, and return only { type } from the handler or middleware. For a reject, you can instead keep that middleware off the HEAD route.

An outcome uses status 304 on a method other than GET or HEAD.

Fix: use a different status, or move the outcome to a GET or HEAD route.

A handler returns a type that is not declared in its route’s responses, or a middleware returns one that is not in its own rejects. The message lists the valid names.

Fix: correct the name, or declare the outcome.

Two outcomes that can end the same operation share a name: a route outcome and a middleware reject, or the rejects of two middleware in one chain. With authentication configured, Routa owns authenticationFailed on every operation, authenticationRequired behind requireAuth, and, with multipleCredentials: "reject", ambiguousCredentials on operations that accept two or more schemes, so a route outcome or reject cannot use those names. The handler result names its outcome, so the names must be distinct.

Fix: rename one of them. A route does not need to redeclare a reject its middleware already declares.

Outcomes that can end the same operation share a status, and clients could not tell them apart. Body outcomes need a required property with a single string, number, or boolean literal value that differs, as text, in every outcome. A body outcome and a bodyless outcome cannot share a status, and neither can two bodyless outcomes. Route outcomes and middleware rejects count alike.

Fix: add a literal discriminator such as kind: z.literal("created") to each body schema, or give each outcome its own status. See Outcomes That Share a Status.

A returned result object contains a field other than type, data, headers, and cookies.

Fix: remove the extra field. Results are limited to those four so every response can be described in OpenAPI. Move anything else into data, or declare it as a response header.

An outcome’s headers declares a name that is not a valid HTTP header name, or one that is not lowercase, such as ETag.

Fix: declare the name in lowercase (etag), using only letters, digits, and the characters allowed in a header name.

An outcome’s headers declares two names that differ only in case, such as etag and ETag. Header identity is case-insensitive and has one owner.

Fix: declare the header once, in lowercase.

An outcome’s headers declares a header Routa owns: content-type, content-length, transfer-encoding, connection, or set-cookie.

Fix: remove it. Routa sets content headers from the body and the transport. Declare response cookies as cookies, never as a set-cookie header.

An outcome’s headers declares deprecation, sunset, or link on a route whose lifecycle headers Routa may write. routa check reads lifecycleHeaders without running your code: an omitted key or a literal false is off, and any other value, such as process.env.LIFECYCLE === "1", counts as possibly on. So does a config it cannot read: a variable, a call, a spread, or a computed key. A default config exported without a local createRouta call, including a re-export, also counts as possibly on. A later literal false overrides an earlier spread, and createRouta() with no config is off. link is owned only when the route’s deprecation names a replacement. The deprecation can be an inline object or a local constant. When it is neither, and the route declares link, routa check reports ROUTA_SCHEMA_UNSUPPORTED because it cannot tell who owns that header.

Fix: remove the header, or set lifecycleHeaders: false. If the deprecation is not readable, write it as an inline object or a local constant.

An outcome’s headers declares a value that is not a string, number, or boolean (or a literal or enum of them), such as an array or an object. Routa has no multi-value header support.

Fix: declare a string, number, or boolean schema.

An outcome’s cookies is not an array literal of identifiers, or of { handle, required: true } entries, that resolve to a createCookie({ ... }) declaration. Routa follows identifiers declared in the route file or its schemas.ts, and relative imports and re-exports: export const, export { name }, aliases, export { name } from, and export * from. It does not follow package imports, aliases of other variables, or spreads.

Fix: list handles by name, write a required one as { handle: session, required: true }, and declare each handle with createCookie in a module the route imports by relative path.

A createCookie call writes its name or an attribute as something other than a literal, or spreads another object. A required cookie entry in cookies must also be a literal, with required: true. Cookie names and attributes are contract facts that routa check and OpenAPI read without running your code.

Fix: write each name and attribute as a literal inside createCookie({ ... }).

A createCookie call omits httpOnly, secure, sameSite, path, or schema, or gives an attribute a value it cannot have, such as a negative maxAge, a path without a leading /, with a trailing space, or with characters outside printable ASCII (write those percent-encoded), or an expires that is not an ISO 8601 date-time.

Fix: declare the required attributes and correct the value.

A cookie name is not an RFC 6265 token: it is empty or contains a space, ;, ,, =, or another separator.

Fix: use letters, digits, and the characters ! # $ % & ' * + - . ^ _ ` | ~.

A cookie breaks a security rule: sameSite: "none" or partitioned: true without secure: true, a __Secure- name without secure: true, or a __Host- name without secure: true, with a path other than /, or with a domain.

Fix: set secure: true, and for __Host- cookies use path: "/" and remove domain.

A cookie’s value schema is not a string, number, or boolean (or a literal or enum of them). A value schema that changes values reports ROUTA_RESPONSE_SCHEMA_MUTATION instead.

Fix: declare a scalar schema that validates the value without changing it.

Outcomes that share a status declare one header name with different schemas or metadata. OpenAPI documents one Header Object per name for the status.

Fix: declare the header the same way in each outcome, or use distinct statuses.

An outcome’s cookies lists the same handle twice, or two handles with one identity (name, domain, and path). One producer owns an identity in a response. Outcomes that share a status also report this when they list one identity from different createCookie declarations.

Fix: list the cookie once, share one handle between the outcomes, or give the handles different names, domains, or paths.

An outcome declares cookies with one name and different domains or paths. This is a warning: browsers keep them apart, but clients and readers often confuse them.

Fix: rename a cookie unless the different scopes are intended.

A schemas.ts file exports two schemas with the same name. Exported schema names become OpenAPI component names. Across files, identical declarations with the same name share a component, and different ones fail with ROUTA_SCHEMA_COMPONENT_COLLISION.

Fix: rename one to something contract-specific, such as CreateUserResponse.

A middleware requires a context key that nothing earlier in the chain provides.

Fix: move the providing middleware earlier. Chain order is folder middleware, then route-level, then method-level, and within a middleware.ts file it is export order.

A middleware rejects entry uses a status outside the 4xx and 5xx ranges.

Fix: use an error status. A middleware that needs to return a success response is a handler concern, not a reject.

A middleware reference could not be resolved statically, usually because the array spreads another array or computes an entry.

Fix: list each middleware as a direct identifier of a createMiddleware export, or of a typed helper’s, such as defineRateLimitMiddleware({ ... }) where the helper is a const or relative import bound to createMiddleware<Requirements>(). Unresolvable middleware would run without contract checks, so Routa refuses it.

A middleware provides is something routa check cannot read, such as a function call, a spread, or a computed key.

Fix: declare provides as an object literal, or name a const object literal declared locally or imported. Routa would otherwise miss the context the middleware provides.

A middleware provides services or passes it to next(). Routa reserves ctx.services for injected services. When src/routa.ts configures authentication, a middleware that provides auth fails too, because Routa resolves ctx.auth from the request’s credential.

Fix: rename the context key. When the value is an application dependency, declare it as an application service instead.

routa check cannot read the authentication config in src/routa.ts, its schemes, a scheme name, a scheme’s descriptor, an API-key header or session cookie, a custom scheme’s transport or openapi metadata, priority, or multipleCredentials. Examples: authentication: makeAuthentication(), a spread or computed key inside authentication, schemes, or a descriptor call’s options, a scheme whose value is not a bearer({ ... }), apiKey({ ... }), sessionCookie({ ... }), or custom({ ... }) call imported from @routa-ts/core, header: process.env.HEADER, transport: certificateHeader, or priority: order. These are contract facts, so Routa reads them without running src/routa.ts.

ROUTA_AUTH_CONFIG_UNRESOLVED: Authentication scheme "serviceKey" declares a header that is not a string literal.
ROUTA_AUTH_CONFIG_UNRESOLVED: The authentication priority in src/routa.ts is not a literal list of scheme names.

Fix: write authentication as an object literal, or a const object literal it can follow, with a plain key for each scheme and a descriptor call, or a const bound to one, as its value. Write header, cookie, transport, openapi, priority, and multipleCredentials as literals.

Warning. The default-exported createRouta config in src/routa.ts has a spread, computed key, or config argument that Routa cannot read, such as ...makeConfig() or createRouta(makeConfig()), and no visible authentication member after it. Authentication inside it never reaches generated metadata or OpenAPI. If the unread part does supply authentication, routa dev and routa start refuse to start. An unread part that holds only tuning values starts normally.

Fix: declare authentication as a member of the createRouta object after any spread, or spread a const object literal Routa can follow.

The authentication config has no principal, declares no schemes, names a scheme that does not start with a letter or has a character other than letters, digits, ., -, and _, declares an API-key header or session cookie that is not an RFC 9110 token, or sets multipleCredentials to a value other than "priority" or "reject". A custom scheme also fails when its transport is missing, names both or neither of a header and a cookie, uses a name or auth-scheme that is not a token, or puts scheme on a header other than Authorization, and when its openapi metadata is missing, has an unsupported type or member, or disagrees with the transport: http needs a matching Authorization auth-scheme, apiKey names the header or cookie the scheme reads whole, and mutualTLS needs a header other than Authorization. A scheme name is the OpenAPI security scheme key, and a leading letter keeps scheme order the same in source and at runtime.

ROUTA_AUTH_CONFIG_INVALID: Authentication scheme "serviceKey" declares header "x api key", which is not an HTTP header name.
ROUTA_AUTH_CONFIG_INVALID: The authentication multipleCredentials in src/routa.ts is "first". Use "priority" or "reject".
ROUTA_AUTH_CONFIG_INVALID: Authentication scheme "basicUser" declares openapi { type: "http" }, which needs an { header: "authorization", scheme } transport whose scheme is "basic".

Fix: add a principal schema, declare at least one scheme, rename the scheme, use a header or cookie name of letters, digits, and !#$%&'*+-.^_`|~, set a supported multipleCredentials mode, or make a custom scheme’s openapi metadata describe its transport.

Two schemes read the same credential, so Routa could not tell which authenticator owns it:

  • two bearer() schemes, which both read Authorization: Bearer;
  • two apiKey() schemes whose headers match ignoring case, such as X-Api-Key and x-api-key;
  • two sessionCookie() schemes with the same cookie name;
  • an apiKey() header named Authorization, which carries Authorization-scheme credentials such as Bearer, or Cookie, which carries session cookies;
  • a custom() transport another scheme reads: { header: "authorization", scheme: "Bearer" } beside bearer(), the same header or the same header and auth-scheme as another custom scheme, or a header an apiKey() reads, all ignoring case, or a cookie a sessionCookie() or other custom scheme reads;
  • a custom() transport { header: "authorization" } without a scheme, which reads the whole header, beside bearer() or any other Authorization transport, or { header: "cookie" } beside any cookie transport.
ROUTA_AUTH_TRANSPORT_OVERLAP: Authentication schemes "partnerKey" and "serviceKey" both read the x-api-key header.

Fix: keep one scheme per transport and accept every token, key, session, or credential format in its authenticator. Read an API key from its own header, and use bearer() or sessionCookie() for the Authorization and Cookie transports.

A scheme’s challenge override is not a literal object, declares a key other than realm, or scheme and realm for a custom scheme, has a realm that is not a string literal of printable ASCII without " or \, or has a custom scheme that is not an RFC 9110 token.

// Fails: the realm is computed
bearer({ challenge: { realm: process.env.REALM }, authenticate });

Fix: write a literal such as challenge: { realm: "api" }. A challenge is public, so it holds no runtime values.

A route or a folder middleware.ts uses requireAuth(), but src/routa.ts configures no authentication, so no request could ever pass the guard.

Fix: configure authentication in createRouta, or remove the guard.

requireAuth({ schemes: [...] }) or authentication.priority lists a name src/routa.ts does not declare. For requireAuth, the message lists the declared schemes.

Fix: use a declared scheme name. TypeScript reports the same mistake in priority, and in requireAuth once .routa/routes.gen.ts is current.

authentication.priority lists a scheme more than once, or omits a declared scheme. Priority orders every scheme, so Routa never guesses where an unlisted one belongs.

ROUTA_AUTH_PRIORITY_INVALID: The authentication priority in src/routa.ts omits "serviceKey".

Fix: list every declared scheme exactly once, or omit priority to use declaration order.

requireAuth({ schemes: [] }) allows no schemes, so it would reject every request. The same code reports an operation whose requireAuth guards, from its folders down to its method, allow no scheme in common. The message names each guard’s file and the schemes it allows.

ROUTA_AUTH_REQUIREMENT_EMPTY: requireAuth() guards on GET /projects allow no scheme in common, so no request could pass them: src/routes/(private)/middleware.ts allows "session"; src/routes/(private)/projects/route.ts allows "userToken".

Fix: list at least one scheme, call requireAuth() to accept any configured scheme, or make the guards on one operation share a scheme. A descendant cannot widen an inherited requirement, so allow the scheme in the folder guard when its routes need it.

requireAuth receives options routa check cannot read, such as requireAuth(options), requireAuth({ ...options }), or requireAuth({ schemes: allowed }). The same code reports a folder middleware.ts export that builds a guard without being a literal call bound to a const: a conditional, a destructuring, a let or var binding, or a factory call that reaches requireAuth at any depth, through your project’s functions, named imports, and re-exports. Routa would not run that guard, and the routes below would stay public.

src/routes/(private)/middleware.ts
import { guardFor } from "../../guards.js";
// Fails: a factory call, not a literal requireAuth() call
export const signedIn = guardFor("session");
// Fails: a destructured binding
export const { adminOnly } = { adminOnly: guardFor("userToken") };
ROUTA_AUTH_REQUIREMENT_UNRESOLVED: src/routes/(private)/middleware.ts exports signedIn, which builds a requireAuth() guard routa check cannot read, so the guard would not run.

Fix: call requireAuth(), or list scheme names inline: requireAuth({ schemes: ["userToken"] }). In a folder, export the call as a const, a const bound to one, or a re-export of either. routa check does not read package code, so startup refuses a guard a package builds; see Authentication Requirements.

Warning. A requireAuth guard lists a scheme that a guard before it on the same operation excludes, such as a route guard that allows "userToken" under a folder guard that allows only "session". Requirements only narrow, so that scheme never authenticates the operation.

ROUTA_AUTH_REQUIREMENT_WIDENED: requireAuth() in src/routes/(private)/projects/route.ts allows "userToken", which the requireAuth() in src/routes/(private)/middleware.ts it follows does not. Requirements only narrow, so it accepts "session".

Fix: remove the excluded scheme from the list. To accept it, allow it in the earlier guard.

A services value is not built through a defineServices helper that Routa can follow, such as a bare function or a call to another helper, or a route root or inline createRoute writes services as a getter, a method, or a computed key. Routa reads services in src/routa.ts, on a route root, and on an inline createRoute, including the shorthand { services }.

Fix: declare const defineAppServices = defineServices<AppServices>(); and set services: defineAppServices(factory), or write defineServices<AppServices>()(factory). Each binding must be a const declaration or a relative import.

Warning. The default-exported createRouta config in src/routa.ts has a spread, computed key, or config argument that Routa cannot read, such as ...makeConfig() or createRouta(makeConfig()), and no visible services member after it. Services inside it never reach generated metadata. If the unread part does supply services, routa dev and routa start refuse to start when no visible services member exists, and a visible member it follows may be replaced by a factory Routa never checked. An unread part that holds only tuning values starts normally.

Fix: declare services as a member of the createRouta object after any spread, or pass or spread a const object literal declared locally or imported. When the unread part holds only tuning values, accept the warning.

A route root or an inline createRoute object with a spread or a non-literal computed key, and no visible services member after it, reports the same warning for that scope. Declare its services as a visible member after any spread.

The contract passed to defineServices, or the requirement interface passed to createMiddleware<Requirements>(), is an inline type, cannot be found, or is not exported, so generated types cannot reference it.

Fix: declare the contract or requirement as an exported interface, or an exported type alias of an object type, in a project module and pass its name.

The contract or requirement interface is not a fixed set of required services: it has an optional member, an index signature, a computed name, type parameters, or an extends clause, or it is not an object type.

Fix: list each service directly as a required, plainly named property.

Two scopes that run in one request declare the same service name: the application and a route file, or a method and the application or its route file. One would hide the other in ctx.services.

Fix: rename one of the services. Unrelated route files and methods may reuse a name.

A middleware’s requiresServices names a service that no scope declares before the middleware runs on that route. Filesystem middleware sees application services, route-file middleware also sees the route file’s services, and method middleware also sees the method’s. A service that only a later factory of the same request builds is still unavailable, and the message names that factory.

ROUTA_SERVICES_UNAVAILABLE: src/routes/middleware.ts: Filesystem middleware withRateLimit requires service "limiter", which /orders does not provide before it runs. The route file's services declare it, but their factory runs after this middleware.
Suggestion: Filesystem middleware sees only application services. Declare "limiter" in the application services, or move the middleware into a route file or method that declares it.

Fix: declare the service in a scope that runs before the middleware, or move the middleware to a placement that has it. A service that exists with an incompatible type is a TypeScript error at that placement’s line in .routa/routes.gen.ts; see Valid and Invalid Placements.

ROUTA_DEPRECATION_REPLACEMENT_ROUTE_NOT_FOUND

Section titled “ROUTA_DEPRECATION_REPLACEMENT_ROUTE_NOT_FOUND”

deprecation.replacement starts with / but does not match a route in this project.

Fix: correct the path, or run routa generate if the target route is new and metadata is stale.

deprecation.replacement is neither a local path beginning with / nor an absolute http: or https: URL.

Fix: use /new-route for this API, or https://api.example.com/new-route for another.

Routa reads route and middleware schemas statically to check them and to generate OpenAPI. These codes name the schemas it cannot read faithfully. See Schemas for what is supported.

A schema uses a construct Routa cannot describe in OpenAPI, such as z.tuple(), .extend(), z.date(), a schema built by calling your own function, or a value that is not a Zod schema. Route input also needs static params, query, headers, cookies, or body properties, not a spread or a shared variable, and each outcome in responses or a middleware’s rejects needs an identifier or string-literal name, a literal status, and a schema written in place, not spread in. A createMiddleware config cannot spread in properties after its rejects, or anywhere when it has no rejects, because the spread could hide or replace them.

In response schemas, Routa also reports a .check() argument it cannot classify, such as a check built by your own function, and URL options whose normalize value it cannot read.

Fix: write the schema with supported Zod constructs. Compose objects with z.intersection() or .and(), and describe dates on the wire with z.iso.datetime() or z.iso.date(). Pass .check() a Zod check such as z.minLength(1) or an inline function, and write URL options as an object literal.

A schema identifier does not name a declaration Routa can read. Routa reads route schemas from the route file and its sibling schemas.ts, middleware reject schemas from the file that declares the middleware, and schemas those files import by name through a relative path, following aliases and re-exports. It does not resolve package imports, tsconfig path aliases, default imports, or modules it cannot find. A namespace member such as schemas.User reports ROUTA_SCHEMA_UNSUPPORTED instead.

Fix: declare the schema in one of those files, or export it with export const from a project module and import it by name through a relative path.

A response schema changes the value it validates, for example with .transform(), .default(), z.coerce.number(), .trim(), .check(z.trim()), z.url({ normalize: true }), or a record key such as z.string().toLowerCase().

Fix: return the wire-ready value from the handler and keep the response schema validation-only.

Warning. An input schema runs a function before any schema Routa can read, through z.preprocess() or a leading z.transform(). The route still runs, and OpenAPI documents the schema that follows the function.

Fix: parse the incoming value with a declarative schema first, then change it with .transform() or .pipe(), or accept the warning.

.meta() sets a key that would override the schema’s structure, such as type, properties, format, or default.

Fix: express the constraint with the Zod schema and keep .meta() for documentation.

.meta() sets a key that places the schema in a route, such as in, param, or operationId.

Fix: put the schema under input or responses in createRoute.

.meta() sets a key Routa does not document.

Fix: use id, title, description, deprecated, example, examples, readOnly, writeOnly, externalDocs, or an x- extension.

Metadata is computed at runtime, for example .describe(label) or a spread in .meta().

Fix: write metadata as inline literals.

A schema file uses z.globalRegistry, z.registry(), or .register(), including globalRegistry or registry imported by name from zod. Registry metadata lives outside the route contract.

Fix: attach documentation with .meta() or .describe() on the schema the route uses.

One components.schemas key would hold two different schemas. This happens in three cases:

  • Two different declarations share a key: two .meta({ id }) calls with the same id, or two exports with the same name and different content.
  • One declaration projects differently in different places, for example input and output, or a query parameter and a JSON body. A schema such as z.stringbool() has a different shape in each, so it cannot be one component.
  • With authentication configured, one of your schemas claims a key that holds a Routa problem body: RoutaAuthenticationFailed, RoutaAuthenticationRequired when an operation is behind requireAuth, or RoutaAmbiguousCredentials when strict mode can return it. See Authentication.

Fix: for two declarations, reuse one declaration, or give each a distinct .meta({ id }). For one declaration with different projections, write separate declarations with distinct component identities, or change the schema so every use projects the same way. For a Routa problem body, rename your export or give it a different .meta({ id }). Routa never renames components or picks one projection.

A schema id or export name used as a component key contains characters OpenAPI does not allow.

Fix: use only letters, digits, ., -, and _.

routa scaffold received a file that is not .yaml, .yml, or .json.

Fix: pass a .yaml, .yml, or .json file.

The OpenAPI file path does not exist relative to the project root.

Fix: pass a path relative to the project root.

routa openapi breaking could not parse .routa/openapi-baseline.json.

Fix: fix the JSON syntax, or replace the baseline with routa openapi breaking --update-baseline, which writes the current contract without reading the old file.

routa scaffold checks the OpenAPI file before it writes anything and stops at the first problem. Each code below names the location in the file.

The OpenAPI file is not valid YAML or JSON. The message includes the parser error.

Fix: fix the syntax the parser reports, then rerun routa scaffold.

The document has no top-level paths object. When route keys such as /users sit at the root, the message shows them nested under paths.

Fix: add openapi, info, and paths at the top level, and nest every route under paths.

The top-level paths value is not an object.

Fix: make paths an object that maps URL paths to their methods.

The document has no top-level openapi field.

Fix: add openapi: 3.1.0 at the top of the file.

The top-level info field is missing or is not an object.

Fix: add an info object with title and version.

A key under paths does not start with /.

Fix: start every path key with /, such as /users.

A path’s value is not an object of HTTP method operations.

Fix: put operations such as get or post under the path.

A path segment is ., .., or contains a backslash or NUL character. Routa turns paths into src/routes directories, so a segment must stay inside the project.

Fix: rename the segment.

The document declares an options operation. Routa answers OPTIONS at runtime from the path’s methods.

Fix: remove the options operation.

A key under a path is not a supported HTTP method, or is one in the wrong case, such as GET.

Fix: use a lowercase supported method: get, post, put, patch, delete, or head.

A method’s value is not an operation object.

Fix: make the method an object with operationId and responses.

An operation has no operationId. Routa names generated schemas and route code after it.

Fix: add the operationId the message suggests, or your own.

Two operations share an operationId. The message names both locations.

Fix: give each operation a unique operationId.

A get operation declares a requestBody. Routa route contracts do not accept a body on GET.

Fix: move the data into query parameters, or use another method.

The document has no operation Routa can scaffold.

Fix: add at least one supported method under paths.

A path-level or operation parameters field is not an array.

Fix: make parameters an array, or remove the field.

A path parameter does not set required: true. OpenAPI path parameters are always required.

Fix: add required: true to the parameter.

The path has a {name} segment with no matching in: path parameter.

Fix: add a parameter entry such as { name, in: path, required: true, schema: { type: string } }.

A path parameter is declared but its {name} segment does not appear in the path.

Fix: add the segment to the path, or remove the parameter.

ROUTA_OPENAPI_UNSUPPORTED_PARAMETER_SCHEMA

Section titled “ROUTA_OPENAPI_UNSUPPORTED_PARAMETER_SCHEMA”

A parameter’s schema is not a string, number, integer, boolean, or enum. Parameters arrive as single string values.

Fix: use a scalar schema, or move structured data into the request body.

requestBody.content is not an object.

Fix: make requestBody.content an object with an application/json entry.

ROUTA_OPENAPI_UNSUPPORTED_REQUEST_MEDIA_TYPE

Section titled “ROUTA_OPENAPI_UNSUPPORTED_REQUEST_MEDIA_TYPE”

requestBody.content has a media type other than application/json.

Fix: declare the request body as application/json.

An operation has no responses, or an empty responses object.

Fix: declare at least one response, such as "200": { description: OK }.

A response key is not a three-digit status from 100 to 599. Ranges such as 2XX and default are not supported.

Fix: use explicit numeric status keys such as "200" or "404".

A response’s content is present but is not an object.

Fix: make content an object with an application/json entry, or remove it for a bodyless response.

ROUTA_OPENAPI_UNSUPPORTED_RESPONSE_MEDIA_TYPE

Section titled “ROUTA_OPENAPI_UNSUPPORTED_RESPONSE_MEDIA_TYPE”

A response’s content has a media type other than application/json.

Fix: declare the response body as application/json.

A schema uses a feature scaffolding cannot translate: allOf, oneOf without a usable discriminator, a type array with more than one non-null entry, the OpenAPI 3.0 nullable flag, additionalProperties beside fixed properties, or a non-scalar const. The message names the feature.

Fix: rewrite the schema with the supported forms the message lists, such as type: ["string", "null"] in place of nullable.

A $ref points outside #/components/schemas/.

Fix: use local refs such as #/components/schemas/User.

A local $ref names a component schema that does not exist.

Fix: add the component under components.schemas, or point the ref at an existing one.

ROUTA_OPENAPI_INVALID_TYPESCRIPT_IDENTIFIER

Section titled “ROUTA_OPENAPI_INVALID_TYPESCRIPT_IDENTIFIER”

An operationId, parameter, or component name produces a name that is not a valid TypeScript identifier.

Fix: rename it in the OpenAPI file.

A file already exists where scaffolding wants to write, and .routa/manifest.json does not track it.

Fix: move or rename your file. If Routa did generate it and the manifest was lost, restore the manifest from version control.

A tracked generated file no longer matches its recorded hash, or its manifest hash is missing. Routa refuses to overwrite or remove it because local edits may be lost.

Fix: move the edits into application-owned modules, then regenerate. Run with --preview first to see the full list. If the hash is missing, restore .routa/manifest.json from version control before regenerating.

Scaffolding computed a file path outside the project root and refused to touch it.

Fix: check the paths in the OpenAPI file and the entries in .routa/manifest.json; every generated file must stay inside the project.

.routa/manifest.json is not valid JSON.

Fix: fix the JSON syntax, or restore the file from version control. Deleting the manifest makes the next scaffold treat every generated file as new.

Some conditions fail without a ROUTA_* code because they are detected at registration or in the OpenAPI commands rather than during route validation:

Message Meaning
Missing .routa/openapi-baseline.json. Run routa scaffold first. No accepted contract exists yet
Regeneration requires preview or confirmation. Scaffolding again without --preview or --yes
Outcome "…" on … is declared by … and by … A route outcome and a reject, or two rejects, share a name
Duplicate route registration: … The same method and path registered twice at runtime
Middleware requires ctx.… but it was not provided. A required context key was missing at request time
Middleware … on … requires service "…", but ctx.services does not … A required service was missing at request time
… provides ctx.services, which Routa reserves … A provides schema cast past TypeScript names services
src/routa.ts configures services that routa generate could not read … A spread or computed config hides services
.routa/routes.gen.ts declares application services, but … Metadata is stale after removing services; regenerate
The application services factory must return exactly … The factory returned missing or extra service names
Missing compiled runtime output for … routa start without a current routa build