Standard error code catalogue#
The values that appear in CallError.code: the standard hierarchy adapters emit codes under, the
contract on adapter authors, and the leaf codes the reference
adapters use. The matching semantics that consume these codes are
in [LCCO.8.3]; this
doc owns the namespace.
Paired with:
[LCRS] for the
CallErrorfact schema.[LCCO] for the hierarchical pattern-match grammar.
[LADP] for adapter- side obligations more broadly.
[LERR] for the meta-policy that tells feature designers when to surface errors as
CallErrorvs other channels.
What this is not#
Not a duplicate of the matching semantics. Pattern-match grammar lives in [LCCO.8.3]; this doc lists the values patterns match against.
Not a runtime error catalogue. DS's own internal errors (compile-time, lowering, runtime invariant violations) are not
CallError.codevalues; they live in [LERR].
Wire format [LECC.1]#
[LECC.1.1] CallError.code is a String per [LCRS.4.2.1].
Adapters must emit values matching the lexical shape below; the
engine treats codes as opaque strings on the wire and applies the
matching contract per [LCCO.8.3] at the rule-language layer.
see also: LCCO.8.3, LCRS.4.2.1
[LECC.1.2] A code value must match the regex
[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*. Each dot-separated segment
is lower-snake-case and starts with a letter. Empty segments,
leading or trailing dots, uppercase letters, and hyphens are
forbidden.
ratified
[LECC.1.3] The leftmost segment is the family. Subsequent
segments narrow within the family. A code with one segment is
malformed for adapter-emitted codes; adapters must always emit at
least <family>.<leaf> form so authors can match either by
family or by leaf per [LCCO.8.3.2].
checks: alloy×2 — see also: LCCO.8.3.2
[LECC.1.5] The engine rewrites a malformed code it is handed. When the host
hands the engine a CallError whose code does not match [LECC.1.2]'s pattern,
the engine must place it in working memory with code set to
internal.invariant ([LECC.3.7.2]) and every other slot as given, and must
count the rewrite in ds.errors.code_invariant_total ([NMET.4.1]). No rule sees
the malformed code.
The engine checks [LECC.1.2]'s pattern and nothing more. A code with one segment, which [LECC.1.3] forbids an adapter to send, matches the pattern and enters as given.
ratified — see also: LECC.1.2, LECC.1.3, LECC.3.7.2, NMET.4.1
[LECC.1.4] The maximum segment count is four. Codes deeper than
<family>.<a>.<b>.<c> are forbidden, and the compiler must refuse an error
pattern of more segments with DS_VALIDATE_ERROR_PATTERN_TOO_DEEP. Four levels suffice for the
families catalogued in §3 and bound the matching cost in
[LCCO.8.3.2].
ratified — checks: alloy — see also: LCCO.8.3.2
Standard families [LECC.2]#
[LECC.2.1] Adapters must emit CallError.code values whose
family is one of the families of [LECC.2.2], the one whose semantics
the failure matches.
see also: LECC.2.2
[LECC.2.2] The standard families are:
request.*— the request was rejected at validation or dispatch, before the adapter attempted to contact the backend.internal.*— adapter or runtime bug. The failure is the adapter's fault, not the upstream's.adapter.*— the system the adapter fronts failed: it was unreachable, refused the request, throttled it or answered wrongly. The adapter chooses the leaf ([LECC.4.3]).
There are no other families.
see also: LECC.4.3
[LECC.2.3] An adapter must pick the most specific family that
applies. Arguments DS accepted but the adapter cannot use are
request.invalid_args, not internal.bug — the request was
well-formed at the DS boundary and wrong at the adapter's.
Anything about the upstream the adapter fronts belongs in
adapter.* ([LECC.4.3]), not stretched into request or
internal because one nearly fits.
see also: LECC.4.3
[LECC.2.4] When two codes could apply, adapters must prefer
the one that names the cause the rule author would want to
react to. A throttling response belongs under a single stable
adapter.* code ([LECC.4.3]) rather than being split
across several, because an author writing one error clause
wants to catch all throttling however it arrives.
see also: LECC.4.3
Standard leaf codes [LECC.3]#
The leaves below are normative. Adapters must use these names when the failure matches the listed semantics. Adapters may add new leaves under a standard family when the existing leaves do not cover the case; new leaves must follow §1's lexical shape.
request.* [LECC.3.1]#
[LECC.3.1.1]
request.unsupported— the adapter does not offer the named service.
[LECC.3.1.2]
request.invalid_args— the request's kwargs failed schema validation per [LADP.8].
see also: LADP.8
[LECC.3.1.3]
request.malformed— the adapter could not construct an outbound request from the call (e.g., a required slot was missing after substitution). Distinct fromrequest.invalid_args, which is schema validation.
[LECC.3.1.4]
request.limit_exceeded— the request exceeded an adapter-enforced cap (a result size, a query window).
internal.* [LECC.3.7]#
[LECC.3.7.1]
internal.crash— the adapter raised an unhandled exception while servicing the call.
[LECC.3.7.2]
internal.invariant— the adapter detected a violated invariant during the call's lifecycle.
[LECC.3.7.3]
internal.bug— catch-all for adapter logic errors that do not fit the prior two leaves. Adapters should prefer the specific leaves;internal.bugis the fallback.
The adapter family [LECC.4]#
[LECC.4.3] The adapter names the leaf under adapter
(adapter.throttled), in [LECC.1.2]'s shape. The rule runs both ways. An
adapter must not stretch request or internal to cover something their
semantics do not: request.* is about the request as it crossed the DS
boundary and internal.* about a bug in the adapter or the runtime, so
any failure of the system the adapter fronts is neither and
belongs under adapter.*. Equally, an adapter must not
mint an adapter.* name for a condition request or internal already
covers — malformed arguments are request.malformed, not
adapter.bad_args. Two names for one condition is what
this rule exists to prevent.
see also: LECC.1.2
Engine-emitted codes [LECC.5]#
[LECC.5.1] Some codes are emitted by the engine itself rather than by an adapter. These describe failures in the engine's own dispatch path before or after the adapter is involved.
[LECC.5.2] The engine-emitted codes in v1 are:
[LECC.5.2.2]
request.unsupported— no adapter is registered for the call's target. Distinct from the adapter-emitted form in [LECC.3.1.1] only by source; the wire shape and matching semantics are identical.
see also: LECC.3.1.1
[LECC.5.3] Authors must not distinguish engine-emitted from
adapter-emitted codes by code value. Both surface as CallError
facts with the same matching contract; the message field may
carry source detail for human inspection.
Pattern-match contract [LECC.6]#
[LECC.6.1] The dot-prefix matching semantics for error <pattern>: clauses are defined in [LCCO.8.3]. This doc commits
the namespace those patterns match against; the matching engine
is normative there.
see also: LCCO.8.3
[LECC.6.2] An author writing error request: matches by family and
catches every leaf under request ([LECC.3.1]). An author writing
error request.malformed: pins to that one leaf.
see also: LECC.3.1
[LECC.6.4] A pattern names a family. The first segment of an error <pattern>: clause's pattern must be request, internal or adapter
([LECC.2.2]). The compiler must refuse any other with
DS_VALIDATE_ERROR_PATTERN_UNKNOWN_FAMILY: no code a conforming adapter or the
engine sends can match it.
ratified — see also: LECC.2.2