Skip to content

Error Codes schema

github-actions[bot] edited this page Nov 16, 2026 · 2 revisions

Error codes: @ultimat3/schema

Part of Error codes: every code @ultimat3/schema registers. x errors explain <CODE> --json prints the same row.

Code Means Typical cause Fix
X_SCHEMA_BOUNDS_INVALID an array bound no array can satisfy a t.array(items, { min, max }) whose min or max is not a whole number from 0 up, or whose min is above its max. Thrown where the array is declared, not where a value is parsed: a bound no count satisfies is wrong for every input t.array(items, { min: 1, max: 20 }) — whole numbers, 0 <= min <= max; omit a bound to leave that side open
X_SCHEMA_DEFAULT_INVALID a schema default fails its own schema .default(value) where value is one the schema itself refuses — t.number.min(5).default(1). An omitted field then parsed to a value the same schema rejects when it is sent, and the published JSON Schema stated a default that violates its own bounds, so it is refused where it is WRITTEN, at the first import of the authoring file schema.default(<a value the rule quoted in cause accepts>) — the .default(…) named in the stack; or relax that rule on the schema — then bun test <the authoring file>.test.ts
X_SCHEMA_DEFAULT_UNSHAREABLE a schema default cannot be copied per parse .default(value) where value holds a function, a symbol or anything else structuredClone refuses. Every parse that omits the field must receive its OWN copy — one shared object meant a handler's mutation became the next request's starting value — so a default that cannot be copied is refused where it is WRITTEN, at the first import of the authoring file, rather than shared and bled schema.default({ … }) — a JSON-shaped value (plain object, array, Date, Map, Set); or drop .default() and answer the absent value in the handler
X_SCHEMA_DISCRIMINANT_INVALID a discriminated union member can never be dispatched to a member of t.discriminatedUnion('<key>', […]) that declares no literal at the discriminant, or one whose tag an earlier member already claims. Thrown where the union is built, not where a value is parsed: a member no tag routes to is wrong for every input, so the first import of the authoring file is the earliest honest place to say so t.object({ <key>: t.literal('…'), … }) — the member named in cause, given a literal discriminant and its own value at that key; or merge the two members into one; t.union(...) if the members share no key
X_SCHEMA_ISSUE_CAP_INVALID a validation issue cap no list can meet validate()/validateAsync() was passed a maxIssues that is not a whole number from 1 up validate(schema, value, { maxIssues: 100 }) — or omit maxIssues for the default MAX_ISSUES
X_SCHEMA_SENSITIVE_OUTPUT a sensitive field is reachable from an output a schema field marked .sensitive() (writeOnly: sent in, never sent back) is reachable from an action output or a query rows schema, and an output leaves the server remove .sensitive() from the path named in cause, or drop the field from the output schema, then: x verify
X_SCHEMA_UNSUPPORTED the active schema provider cannot do this a Standard Schema implementation without JSON Schema export drop the configureSchemaProvider() call and use t, the shipped dependency-free builtin provider
X_VALIDATION_FAILED value did not match its schema a parse boundary rejected input read cause for the failing path; correct the value or widen the schema deliberately

Clone this wiki locally