jig-harness/jig
M15 Contracts & error handling · in your tools

M15 mappings — per-ecosystem implementations

The module invariant is tool-independent: a failure keeps its cause, travels on one of three channels, is branched on by type or code, and reaches callers through one boundary. This page maps each piece onto concrete languages, libraries and frameworks. Replace <placeholders> with your values. The module’s reference implementations are its own: reference/detached/, reference/error-registry/, reference/interface-surface/ and reference/migration-immutability/ are TypeScript for Bun and Node, and reference/lint-rules/ holds GritQL rules for Biome; the rest of this page is a feature of the named tool.

Never swallow, keep the cause

EcosystemKeeping the causeLint against swallowing
TypeScript / JavaScriptnew DomainError(code, { cause: error }); the standard Error cause option, read by loggers that print the chainreference/lint-rules/ (catch-return-default, stderr-ignore, json-parse-cast) as Biome GritQL plugins; on ESLint, no-empty with allowEmptyCatch: false, preserve-caught-error (a rethrown wrapper must pass cause), and no-restricted-syntax selectors for a default-returning CatchClause and for stdio: "ignore"
Pythonraise DomainError(code) from error, which sets __cause__; logging.exception(...) inside except records the tracebackRuff: BLE001 (a blind except Exception), S110 (try-except-pass), B904 (raise without from inside except), TRY400 (logging.error where logging.exception keeps the traceback); subprocess.run(..., stderr=subprocess.DEVNULL) found by a grep gate
Gofmt.Errorf("open ledger: %w", err) wraps with %w; errors.Join keeps severalgolangci-lint: errcheck (an error return dropped), nilerr (an error checked, then nil returned), errorlint (%w, and errors.Is/As instead of == and type assertions), wrapcheck (an error from another package returned unwrapped)
Rust? propagates; thiserror’s #[source] and #[from] keep the inner error; anyhow::Context adds a message while keeping the chain#[must_use] on Result is built in (unused_must_use); clippy let_underscore_must_use for let _ = fallible(); clippy unwrap_used and expect_used in library code
JVMnew DomainException(code, cause); the Throwable cause chainError Prone CatchAndPrintStackTrace, UnusedException; SpotBugs DE_MIGHT_IGNORE; Checkstyle EmptyCatchBlock
.NETthrow new DomainException(code, message, inner); InnerExceptionRoslyn analyzers CA1031 (a catch of a general exception type), CA2200 (rethrow that loses the stack); throw; not throw ex;

Whatever the language, the wrapper’s message says what was being done (“open the ledger”), and the cause says what went wrong.

Failure channels

EcosystemThe result type (expected outcomes)The typed error with a code (module boundaries)The defect primitive (bugs)
TypeScript, hand-rolledtype Result<T, E extends { readonly _tag: string }> = { ok: true; value: T } | { ok: false; error: E } with ok, err, isOk, map and unwrapOrThrow beside it; nothing moreclass DomainError extends Error holding an ErrorCode value object (code, severity, message key, recovery hint, transport status); the _tag derived from code with a literal type, so an exhaustive switch narrows to neverinvariant(condition, message) throwing a DefectError, in one shared module
TypeScript, neverthrowResult<T, E> and ResultAsync<T, E> with ok(), err(), .match(), .andThen(); eslint-plugin-neverthrow’s must-use-result fails a dropped resultthe same DomainError, carried in Ethe same primitive
TypeScript, EffectEffect<A, E, R> with Data.TaggedError for the error channel and Effect.catchTag to branch; defects are Cause.Die, never in Ea tagged error class per code, or the domain error wrapped in Data.TaggedErrorEffect.die / Effect.dieMessage
Pythona Result from the returns library (Success/Failure), or a small @dataclass union; an exception is never the expected channelan exception base with a code attribute and the code’s metadata, raised across module boundaries (raise NotFoundError(code=...) from error)assert is stripped under -O, so a dedicated invariant() raising DefectError
Go(T, error) is the result channel: an expected outcome returns a sentinel or typed error the caller tests with errors.Is / errors.Asa struct type implementing error with a Code field, returned across package boundaries, wrapped with %w on the waypanic with a dedicated type, recovered only at the top-level handler
RustResult<T, E> is the language; an expected outcome is an enum variant in Ean error enum per crate derived with thiserror, each variant carrying its code; anyhow only at the binary’s boundaryassert!, unreachable!, or panic! with a dedicated message prefix or payload type, all of which run in optimized builds too; debug_assert! is compiled out of an optimized build, so it is only for a check the program does not depend on
JVMa sealed interface Result<T, E> (Kotlin sealed class, Java sealed records)a DomainException holding an ErrorCode enum or recordIllegalStateException thrown only through an Invariants.check(...) helper

A failure inside a database transaction aborts it, in every ecosystem: the transaction rolls back and none of its partial work commits. Which path rolls back is the tool’s:

Transaction mechanismThe path that rolls backWhat commits by mistake
A callback helper that commits when its callback returns: Drizzle’s and Prisma’s interactive transactions, SQLAlchemy’s with session.begin():a throw out of the callbacka returned error arm, which the helper reads as success
Spring @Transactionalan unchecked exception; a checked one only when rollbackFor names ita checked exception without rollbackFor, and a returned error value
Go database/sqldefer tx.Rollback() and an early return err; tx.Commit() only after every step succeededa Commit reached after an error was recorded rather than returned
Rust SQLxa Transaction dropped without commit() rolls back, so an early return through ? is safe; Connection::transaction rolls back on ErrOk holding an error value, which commits

In each case an expected outcome the caller branches on is converted to the result type outside the transaction, after it has rolled back or committed.

Branch on type or code

EcosystemBranch onLint
TypeScripterror instanceof DomainError, error.code, result.error._tag; assertExhaustive(x: never) in the default of a switch over the tagreference/lint-rules/ no-message-branch and no-bare-throw-error; on ESLint, @typescript-eslint/only-throw-error (no thrown non-errors) plus a no-restricted-syntax selector on MemberExpression[property.name="message"] inside a CatchClause
Pythonexcept NotFoundError as e:, e.code; match on a Result unionRuff TRY002 (a raised bare Exception), TRY003 (a long message built at the raise site instead of in the exception class); a grep gate on str(e) and e.args[0] comparisons
Goerrors.Is(err, ErrNotFound), errors.As(err, &notFound)errorlint (err == ErrX and err.(*T) instead of errors.Is / As); a grep gate on strings.Contains(err.Error(), ...)
Rustmatch on the error enum; downcast_ref::<E>() at an anyhow boundarythe compiler: an unmatched variant fails the build; clippy wildcard_enum_match_arm where exhaustiveness matters
JVMcatch (NotFoundException e), e.getCode(); an exhaustive switch over a sealed typeError Prone CatchFail; a grep gate on getMessage().contains(

The error boundary

StackThe one boundaryThe shape it writesServer-side failures hide detail
Express / Koathe last (err, req, res, next) middleware; Koa’s app.on("error") plus one try/catch middleware{ code, message, severity, recovery, correlationId, details?, detail? }, with details and detail on a 4xx only; a Content-Type of application/problem+json and the Problem Details fields (type, title, status, detail, instance) are the standard wire form when the shape must be publicthe handler strips details and detail when status >= 500, logs them through an allowlist, and maps an unknown error to the generic code
FastifysetErrorHandler on the root instance; setSchemaErrorFormatter for validationthe samethe same
Elysia.onError() in one plugin registered firstthe samethe same
FastAPI / Starlette@app.exception_handler(DomainError) and one for Exceptiona Pydantic model for the bodythe Exception handler returns the generic code and logs; debug=False in production so Starlette never writes a traceback
Djangoone middleware’s process_exception, or Django REST Framework’s EXCEPTION_HANDLER settingthe sameDEBUG = False; the handler writes the generic code
Go net/httpa handler wrapper func(w, r) error that maps the returned error oncea response struct written by one functionerrors.As to the typed error, else the generic code and status 500; the internal error only to the log
gRPC (any language)one server interceptor that maps the typed error to a status code and detailsgoogle.rpc.Status with ErrorInfo (reason as the code, domain, metadata)an unknown error maps to INTERNAL with no message text
Rust axum / actiximpl IntoResponse for AppError; actix’s ResponseErrorone error enum to one body typethe Internal variant writes the generic code; the source only to tracing
Springone @RestControllerAdvice with @ExceptionHandler methodsProblemDetail (Spring 6) with the code in its propertiesthe Exception handler returns the generic code; server.error.include-stacktrace=never, include-message=never
Command-line toolsone exit-code boundary the entry point runs through (lib/cli.ts in Jig)an exit status per outcome (0 passed, 1 findings, 2 could not check) and one line on standard errorthe boundary prints the message, never the stack, unless a debug flag asks

Whatever the stack, the boundary is the only place that knows the transport: the domain error carries no status code of a particular transport, the boundary maps its code’s metadata to one. The public field set is the same everywhere: the code, the message key, the severity, the recovery hint and the correlation id, plus the 4xx-only details. The test that proves the rule sends an unknown error, carrying a recognizable internal message, a cause and a stack, through the boundary, and asserts that the body holds the public field set with the generic code and that no internal detail is in it: not the stack, the cause, query text, a file path or the internal message.

Detached work and unhandled rejections

EcosystemDetached work through one helperThe process-level backstop
TypeScript (Bun, Node)reference/detached/ runDetached; Biome noFloatingPromises or ESLint @typescript-eslint/no-floating-promises finds the un-awaited promise that should go through it, but both accept a promise started with void, so the helper is the only way only when a second rule rejects void outside the helper’s module: Biome noVoid or ESLint no-void, with that module excluded, or no-floating-promises with ignoreVoid: falseinstallUnhandledRejectionListener from the same file, once per entry point, in the runtime’s default mode (--unhandled-rejections=throw, which Bun follows), where the listener handles the rejection and the process keeps running; under --unhandled-rejections=strict the rejection is raised as an uncaught exception first and the listener does not prevent the exit, so the entry point sets no strict flag in its start command or NODE_OPTIONS
Python asynciotasks kept in a set and given a done callback that reports (task.add_done_callback(report)); a task with no reference is collected mid-flightloop.set_exception_handler(report): the “Task exception was never retrieved” warning is what it replaces
Goa go func() started through one spawn(name, fn) that recovers a panic and reports it with the namenone exists: an unrecovered panic in a goroutine ends the process, which is why every goroutine starts through the helper
Rust tokioJoinSet or a JoinHandle that is awaited; a tokio::spawn whose handle is dropped reports nothinga panic hook (std::panic::set_hook) that logs; the task’s JoinError is read where the handle is awaited
JVMan ExecutorService wrapper that submits through Callable and logs a failed Future; Kotlin CoroutineExceptionHandler on the scopeThread.setDefaultUncaughtExceptionHandler

Telemetry keyed on code and type

SignalKeysNever
Metrics (a counter of errors, a duration histogram)error.code (the registered code), error.type (the class name, as the OpenTelemetry semantic conventions name it), outcome (ok or err for a method returning a result type)error.message, an account or user identifier (unbounded cardinality: the OpenTelemetry metrics SDK merges combinations past its per-instrument limit into one overflow bucket, silently)
Spansspan status ERROR only when the method threw; error.code and error.type as attributes; the err arm’s tag as outcomethe message or the stack as an attribute
Structured logsthe fields code, errorName and correlationId; the diagnostic detail (the message and the cause chain’s messages) through the redacting allowlist, with secrets and identifiers masked, and never as a field a dashboard groups bythe request body; a message or a cause chain that has not passed through redaction

The boundary and the telemetry wrapper read the same fields of the same typed error, so a code renamed in the registry changes both, and a dashboard built on codes outlives any rewording.

The error-code registry

The registry is one declaration per code, in data (templates/error-codes.yaml) or in a code module with the same fields; the generators below read it, and each copy they write carries M2’s freshness triad, with a --check that regenerates through the generator’s own function and diffs the whole text.

EcosystemThe registryThe client’s code unionA message catalog per localeThe public reference
TypeScripta module of new ErrorCode(code, metadata) constants, the class unexported where it can bea generated file holding a string-literal union and a runtime array of the codes, so a switch narrows to never and a new code fails the client’s build until it is handledJSON per locale for i18next, next-intl or react-intl, where the generator keeps authored entries, inserts a visible placeholder entry for a new code and drops a retired one, and --check fails on a difference or a placeholder; typesafe-i18n derives types from the base locale so a key missing elsewhere fails the builda generated Markdown page in the docs site (Docusaurus, Starlight), validated by regenerating through the same function
Pythonan Enum whose members carry the metadata, or the data form read by the generatorsa generated Literal[...] type in the client packagegettext .po per locale; msgfmt --check validates the files, and a test that resolves every code’s key in every locale fails on a gap (gettext returns the key itself when it is missing, so the test asserts inequality)a generated page under Sphinx or MkDocs, with --check
Goa const block of codes and a var table of metadata in one packagea generated file in the client module, go generate with stringer for the string formgolang.org/x/text/message catalogs from gotext update, which reports untranslated messagesa generated Markdown page; CI runs go generate ./... and git diff --exit-code
Rustan enum ErrorCode with a metadata() match and strum for the namesthe crate shared with the client, or a TypeScript union generated with ts-rs or spectaFluent .ftl per locale; i18n-embed-fl’s fl! macro checks at compile time that a message id exists in the fallback languagea generated Markdown page; CI regenerates and git diff --exit-code
JVMan enum ErrorCode with a field per metadata itemgenerated from the specification’s enum with openapi-generator, or the enum shared in a client moduleResourceBundle properties per locale, with a test over ErrorCode.values() for every locale; Spring’s MessageSource with useCodeAsDefaultMessage=false throws on a missing keya generated page from an annotation processor or a test that writes and compares
Railsa model of codes with config/locales/*.yml keyed by codea generated TypeScript union from a Rake taski18n-tasks missing fails CI when a locale lacks a key the base locale hasa generated page from the same Rake task
On the wirethe response schema’s code property is an enum generated from the registry in the OpenAPI document, so a client generated from the specification carries the union; gRPC carries the code in google.rpc.ErrorInfo.reason, with a generated protobuf enum beside it
EcosystemNo code constructed outside the registryOrphans and reverse orphans
TypeScriptvisibility: the registry module exports the codes and not the class; where the class must be exported, reference/error-registry/check-no-inline-codes.ts, a Biome GritQL rule on new ErrorCode($args) with the registry left out of its includes, or ESLint no-restricted-syntax on NewExpression[callee.name="ErrorCode"] turned off for the registry in an overrides entryreference/error-registry/audit-error-codes.ts over the packages and the docs; Knip reports a registry constant nothing imports as an unused export
Pythona module-private constructor (_Code) and import-linter’s forbidden contract against importing it outside the registry package; otherwise a grep gate on ErrorCode( outside the registrythe audit; vulture for a constant nothing reads
Goan unexported constructor (newCode) in the registry package: the compiler enforces it; forbidigo where it must be exportedthe audit: an unreferenced exported variable is not something staticcheck reports across packages
Rusta private constructor in the registry module: ErrorCode keeps a private field, so no other module can build one with a struct literal, its new is private to the module, and the codes are associated constants (ErrorCode::ORDER_NOT_FOUND) declared beside it; the compiler enforces it. pub(crate) is not enough, since every module of the crate can call itthe audit; the dead_code lint reports only a constant that is not pub
JVMa package-private constructor; ArchUnit’s noClasses().that().resideOutsideOfPackage("..errors.registry..").should().callConstructor(ErrorCode.class, ...)the audit
Documents, any stackthe audit’s --docs over the hand-written pages; i18n-tasks unused (Rails) for catalog keys nothing resolves

Whatever the stack, the set of packages the gate scans is derived from the dependency graph (every package that depends on the error module: pnpm --filter "...^<errors package>" exec pwd, cargo tree -i <crate>, go list -deps), not listed by hand, so a new dependent is covered the day it appears. The allowlist is kept at zero; the baseline of accepted orphans names each code with its reason and only shrinks.

Migration discipline

A migration that has merged is never edited, renamed or deleted; the ledger and the files match one to one in strictly increasing order; a migration changes structure only. The merge-time gate is one script for every tool (reference/migration-immutability/): it reads git, not the database. The apply-time hash check and the ledger are each tool’s own, and differ in what they refuse.

ToolThe ledger and its orderThe hash at apply, and what refuses driftWhat the repository adds
Flywaythe versioned files’ own numbering; validate (run by migrate by default, validateOnMigrate) fails on a resolved migration older than the latest applied that never ran, so a behind migration is refused, not skipped; outOfOrder=true is the setting that lets it run, off by defaultflyway_schema_history records a checksum per versioned migration; validate fails on a changed one; repair rewrites the recorded checksums and is the escape hatch to keep out of CIthe merge-time gate, so the edit fails in review rather than at the deploy
Liquibasethe changelog file is the ledger and runs changesets in its order, so a changeset file no include names never runs: a check that every file under the directory is includedDATABASECHANGELOG records a digest per changeset; update fails on a changed one (checksum validation); runOnChange, validCheckSum and clearCheckSums are the escape hatchesthe merge-time gate; the inclusion check
Rails (Active Record)schema_migrations records the versions applied; every pending version runs in version order, older ones included, so nothing is skipped; db:migrate:status prints NO FILE for a recorded version with no filenone: the table records versions onlythe merge-time gate is the only guard against an edit; a hash check in a Rake task that records the digests it applied; strong_migrations stops an unsafe structure change and a raw execute without safety_assured; data changes go to data_migrate’s own directory
Alembicthe revision chain in the files (down_revision) is the ledger; alembic heads returning more than one revision, which upgrade head refuses, is the integrity check; alembic_version records the current head onlynonethe merge-time gate; a hash check in the migration command’s wrapper; a data change (op.bulk_insert, op.execute with a data statement) found by walking the Python syntax tree (ast) and parsing the SQL it carries
Prisma Migratethe migration directories’ names, applied in name order; migrate status lists them against _prisma_migrations_prisma_migrations records a checksum per migration; migrate dev refuses an applied migration that changed; migrate deploy applies pending migrations and compares no checksum; migrate resolve is the escape hatchthe merge-time gate is the production guard, since deploy checks nothing
Drizzlemeta/_journal.json: an entry per migration with idx, tag, when and breakpoints; the migrator applies entries whose when is greater than the last applied created_at, so an entry with an earlier when is skipped silently; a ledger check holds idx dense, when strictly increasing, tag and file one to one, and every field explicit on every entry__drizzle_migrations records a hash per applied entry and the migrator compares noneboth checks are the repository’s: the ledger check above, and a drift check in the migration wrapper that pairs the recorded hashes with the journal’s entries by position, hashes each file the same way, and refuses to run on a difference or a missing file; the migrator applies every pending entry in one transaction, so a statement PostgreSQL will not run inside one (CREATE INDEX CONCURRENTLY) or whose effect waits for the commit (ALTER TYPE … ADD VALUE) needs its own path outside the migrator
golang-migratethe files’ version numbers; up applies the versions above the recorded one, so a version behind it never runs: a check that the files’ versions are strictly increasing and that every file above the recorded version is pendingschema_migrations records the current version and a dirty flag, no checksumthe merge-time gate; a hash check in the wrapper; goose, the near relative, refuses a missing migration before the current version by default (-allow-missing is the setting that lets it through) and records no checksum either

A runner with no hash check gets one in the repository’s own wrapper: on first apply it records a digest of each file in a table beside the tool’s own; on every run it recomputes the digests of the applied files and refuses to continue on a difference or a missing file, naming the file, the recorded digest and the file’s. The recovery is always the same: restore the file, or reset an environment that never applied it, or add a new migration.

DatabaseThe parser for the structure-only checkWhat to walk
PostgreSQLthe libpg_query bindings: pg_query (Ruby), pglast (Python), pg_query_go (Go), @pgsql/parser (TypeScript)every InsertStmt, UpdateStmt, DeleteStmt and MergeStmt anywhere in the tree, a WITH query’s included; the body of a DO block and of a CREATE FUNCTION through the procedural-language parser (pglast.parse_plpgsql); an EXECUTE of a constant string re-parsed, any other EXECUTE fails the file
MySQL, MariaDB, SQLitesqlglot (Python) with the dialect namedexp.Insert, exp.Update, exp.Delete found by find_all over each parsed statement
SQL ServerScriptDom (TSql160Parser)a visitor over InsertStatement, UpdateStatement, DeleteStatement, MergeStatement
Migrations written as code (Alembic, Rails, Knex)the language’s own syntax tree for the data operations (op.bulk_insert, op.execute, execute, update_all, insert), then the database’s parser for the SQL strings they carrythe same statement kinds

The allowlist for a data change that must ride in a migration is a file outside the migrations, one entry per statement by identity (the file and the statement with its whitespace normalized), each under the reviewer’s reason; an entry whose statement is no longer there fails the check (M1’s stale-exceptions rule). An in-file marker cannot do this job: the file that needs it has already applied, and gaining a marker is an edit.

The review marker is M1’s commit-msg marker with REVIEW_PATHS_RE set to the migrations directory and REVIEW_MARKER to the migration-review tag, re-checked in CI over the pull request’s commits.

Published interface surface

An operation is internal unless a named external consumer justifies publishing it; every request input declares a bound; an operation’s declared failure responses name every status its code can produce. The two reference gates read an OpenAPI document (reference/interface-surface/); for another contract form, the same checks are written over its own document.

Contract formThe mark at the sourceTwo documents from one sourceThe gate over the published document
OpenAPI (REST)a tag suffix on the operation (Orders (Internal)), an x-internal: true extension, or a path prefix (/internal/), set where the route is declared so the generator reads it from the route schemathe generator runs twice with the filter inverted: the published document without the marked operations, the internal one with only them; over a bundled document, redocly bundle --remove-x-internal or an openapi-filter pass apply the same filtercheck-no-internal-in-published.ts with the mark as its option; the server’s own filter on what it serves at its contract endpoint is tested where the server is
gRPC / protobufa package per audience (<org>.orders.v1 published, <org>.orders.internal internal), or the google.api.visibility method option (restriction: "INTERNAL"), which protoc-gen-openapi and the generated-client generators honourone module, a buf generate template per audience, each built from its package (buf build --path)a check over the published descriptor set (buf build -o) that no internal package and no INTERNAL-restricted method is in it; buf breaking --against on the published package holds its shape
GraphQLa schema directive on the field or type: Apollo Federation’s @inaccessible, which composition drops from the supergraph’s API schema, or a @tag per audience read by a schema contract; a plain @internal directive the build filtersone subgraph schema; the published schema is what composition or the contract filter leavesgraphql-inspector validate with a rule, or a short script over the published schema’s syntax tree, that no field or type carrying the mark remains; graphql-inspector diff against the base holds the shape
Typed RPC (tRPC and kin)a router per audience (publicRouter, internalRouter), mounted at different paths; the client types are generated per routerthe type generation per routera type-level test that no internal procedure is assignable to the public router’s exported type

The consumer question travels with the change: a pull-request template field, or a line in the review checklist, asks who the external consumer of a newly published operation is, what they get, and why not another way. Jig’s review skill asks it in its contract tier.

Schema toolThe boundNamed schemas with their boundsThe count under the ratchet
OpenAPI / JSON SchemamaxLength, pattern, format on a string; maximum, exclusiveMaximum on a number; maxItems on an array; additionalProperties: false or a schema on an open object; enum, const on anythingcomponents/schemas entries (ShortText, EntityName, SearchQuery) referenced by $refcount-unbounded-inputs.ts --base over the document
TypeBox (TypeScript)t.String({ maxLength }), t.String({ pattern }), t.Number({ maximum }), t.Array(..., { maxItems }); the OpenAPI document generated from the route schemas carries themone module of named schemas (const ShortText = t.String({ maxLength: 500 })), a refinement by spread ({ ...ShortText, minLength: 1 }) keeps the boundthe document count; a numeric query parameter declared as a string is a bound in name only, so it is t.Numeric({ maximum })
Zod.max(), .regex(), .email(), .url(), .array().max(), .number().max(); zod-to-openapi and zod-openapi carry them into the documentnamed schemas exported from one modulethe document count, or a lint rule on z.string() and z.number() with no refinement in a request schema
Pydantic (Python)Field(max_length=, pattern=, le=), conlist(max_length=), constr, conint; FastAPI’s generated document carries themAnnotated[str, Field(max_length=255)] aliases in one modulethe document count
Protobufprotovalidate (buf.validate) field options: (buf.validate.field).string.max_len, .repeated.max_items, .int32.lte, .string.patterna message per kind of value, or a shared custom optiona buf lint plugin, or a script over the descriptor set, counting request fields with no constraint
GraphQLgraphql-constraint-directive (@constraint(maxLength: 255, pattern: ...)) on input fields and arguments; a custom scalar per kind of value (ShortText)the custom scalarsa script over the schema’s syntax tree counting String, Int and list inputs with no constraint
Go (validator)struct tags on the request types (validate:"max=255", validate:"dive,max=100"), max= on slicesa named type per kind of value with its own Validatea go vet analyzer, or a grep gate over the request structs, for a string or slice field with no max tag
Contract formWhere the failure statuses are declaredWhat the list holds
OpenAPIthe operation’s responses mapthe boundary’s generic server-side status; the validation status; the authentication and authorization refusals where those layers run; the transport status of each domain error the handler throws, which the registry holds per code, so a generator can derive the list from the codes the route declares; a 2xx with a schema, never an untyped success
gRPCthe method’s comment (// Errors: NOT_FOUND, FAILED_PRECONDITION) and the google.rpc.Status details, with ErrorInfo.reason carrying the registry’s codethe status codes the handler returns and the boundary’s INTERNAL; the generated client’s documentation reads the comment
GraphQLan enum of errors[].extensions.code in the schema, and each field’s description naming the codes it raisesthe registry’s codes, so the client’s exhaustive switch over the enum narrows to never

Source: modules/M15-contracts-errors/mappings.md