Execution Errors¶
Status: active in SPEC_VERSION 0.3.0. Existing codes in
spec/wire/errors.json remain authoritative for existing sentinel identities.
The active inventory is
spec/execution/errors.json,
with status: active and baseSpecVersion: 0.3.0. It defines the execution
classification used by the contract. SDK-specific inventories cover execution
boundaries and core error factories, not every adapter domain.
The classification rules are exercised by language-neutral
spec/execution/error-vectors.json
with a reference classifier in scripts/validation/execution_error_classify.py.
The vectors cover cancellation, classification preservation, privacy projection, deadline,
precedence and unknown-remote fallback. A passing vector run is not by itself an
SDK conformance result.
Here, cause coverage means classification propagation, not native cause-chain retention. The reference classifiers select only the primary classification; they do not retain secondary exceptions or test real event/metric exports. Native wrapping, cause identity, secondary-error retention and runtime privacy remain separate acceptance work.
Stable Classification¶
Compare stable codes, never human-readable messages or exception class names.
Preserve existing codes such as AGENT_MAX_STEPS and AGENT_APPROVAL_DENIED.
Each language retains native exceptions, error chains and cancellation idioms;
one classification operation supplies return values, events, bridge output and
telemetry projections.
| Candidate field | Meaning |
|---|---|
code |
Stable finite machine-readable reason |
category |
configuration, governance, model, tool, resource, transport, lifecycle, internal |
operation |
Finite framework stage, such as model.generate or tool.invoke |
message |
Human-readable description, not a compatibility key |
| local cause | Original native error chain; not automatically serialized |
| restricted details | Allowlisted diagnostic fields; omitted by default |
Run, session and tool-call identifiers belong to correlation context and need not exist on configuration errors. Do not require all languages to serialize a native exception, stack trace or arbitrary cause object.
Coverage And Mapping¶
| Boundary | Required classification |
|---|---|
| Assembly/run validation | Missing model, missing Policy, omitted tool scope, invalid options |
| Governance | Policy denial, out-of-scope tool, approval denial or invalid decision |
| Model | Provider failure, invalid response, unsupported declared operation |
| Tool | Missing tool, invalid arguments, invocation failure |
| Limits | Existing step/token/context/call-limit codes |
| Execution | Cancellation, deadline, middleware/hook failure |
| Observation | Event delivery, stream delivery and cleanup failure |
| Runtime | Internal invariant failure |
Existing specific codes take precedence over generic wrappers. An unknown user tool exception maps to a tool invocation failure while retaining its local cause. A known framework error retains its code when wrapped. Map native cancellation and deadline at the boundary that knows the operation; do not misclassify an unrelated nested cause as cancellation. Keep upstream HTTP status and provider codes separate from the framework code. Unknown remote codes must produce a documented fallback without changing a failed operation into success.
The catalog's boundaries gives exact code/operation pairs, and codes
categorizes all 19 active sentinels without renaming them. Limits are resource;
approval denial, invalid decisions, rubric rejection, selector exclusion and
checkpoint type rejection are governance; missing approval handler is
configuration; structured output validation is model; subagent/plugin state
and drain errors are lifecycle; plugin inflight underflow is internal.
HTTP_BODY_TOO_LARGE is a resource limit, not a generic transport failure.
Limited New Codes¶
Only these 15 strings are new. Other boundary targets reuse existing sentinel or SDK-specific strings, not new synonyms.
| New code | Category | Owning operation / reason |
|---|---|---|
AGENT_MODEL_REQUIRED |
configuration | run.validate: framework model absent |
AGENT_POLICY_REQUIRED |
configuration | run.validate: Policy absent without explicit independent opt-out |
AGENT_TOOL_SCOPE_REQUIRED |
configuration | run.validate: scope omitted; explicit empty scope remains valid |
AGENT_POLICY_FAILED |
governance | policy.authorize: authorizer failed, not a deny decision |
AGENT_MODEL_FAILED |
model | model.generate/model.stream: unclassified invocation failure |
MODEL_OPERATION_UNSUPPORTED |
model | model.generate/model.stream: requested operation unsupported |
TOOL_ARGUMENTS_INVALID |
tool | tool.validate: pre-invocation validation failure |
TOOL_INVOCATION_FAILED |
tool | tool.invoke: unclassified exception or recovered panic |
AGENT_DEADLINE_EXCEEDED |
lifecycle | run.execute/model.generate/model.stream/tool.invoke: owning deadline expired |
MIDDLEWARE_FAILED |
internal | middleware.invoke: callback's own failure |
HOOK_FAILED |
internal | hook.invoke: lifecycle callback's own failure |
SINK_DELIVERY_FAILED |
transport | sink.emit: event delivery failure |
STREAM_DELIVERY_FAILED |
transport | stream.deliver: consumer delivery failure |
EXECUTION_CLEANUP_FAILED |
lifecycle | run.cleanup: otherwise unclassified finalization failure |
EXECUTION_INTERNAL |
internal | run.execute: invariant failure or unknown remote framework reason |
Existing SDK Identities¶
The machine catalog lists explicit sdkMappings, with source paths in evidence.
These are observed code identities and preservation rules, not a claim
of uniform native behavior. Inventory scope is core error factories and execution
boundaries, not every optional adapter's domain codes.
| Existing identity | Evidence and treatment |
|---|---|
AGENT_ABORTED |
Rust PraxoError::aborted(), TS AbortError, Java PraxoException.aborted() already define it. Preserve it, do not rename to cancellation or deadline. A factory does not prove all cancellation paths use it. |
AGENT_CANCELLED |
Rust execution cancellation already uses it. Candidate native cancellation target, distinct from legacy abort. |
AGENT_INVALID_OPTIONS |
Java/Rust required-control checks use this broad code. Preserve it; future checks may emit the specific new missing-control codes without message parsing. |
AGENT_POLICY_DENIED |
Python/TS define it; Java/Rust authorization emits it. Deny decision, not authorizer failure or approval denial. |
POLICY_ERROR |
Python/TS/Java/Rust core errors retain this legacy configuration/evaluation identity. Do not alias to deny or infer finer reasons from text. |
AGENT_TOOL_NOT_ALLOWED |
Rust scope rejection; not AGENT_TOOL_NOT_SELECTED, TOOL_NOT_FOUND, or missing scope. |
TOOL_NOT_FOUND |
Python/TS/Java/Rust existing lookup identity; reused for missing tools. |
AGENT_MIDDLEWARE |
Rust skipped-model-without-response contract failure; retain separately from a callback's own MIDDLEWARE_FAILED. |
AGENT_STREAM |
Rust currently uses one code for unsupported streaming and closed receiver. Preserve the ambiguous legacy code; new detection sites can distinguish unsupported operation from delivery failure. |
MODEL_CONFIG, MODEL_HTTP, MODEL_RESPONSE, MODEL_STREAM |
Rust provider adapter inventory. Preserve configuration, legacy HTTP, invalid response and provider stream identities. HTTP may include empty responses; stream may include read/decode failures. Do not split by message or relabel consumer delivery. |
TOOL_RESULT, AGENT_OFFLOAD |
Rust result serialization/offload failures occur after invocation; do not alias to invocation failure. |
PRAXO_ERROR, CHECKPOINT_ERROR, PLUGIN_INVALID_MANIFEST, MCP_* |
Preserve inventoried SDK identities explicitly. MCP timeout/cancellation stays request-local, not automatically an execution deadline/cancellation. |
Go currently also has plain validation/denial errors and forwards model, tool, hook and middleware errors; not every boundary has a stable sentinel. Python's OpenAI-compatible adapter can raise native exceptions without a framework code. These gaps motivate boundary mapping; the catalog does not claim they are already closed. Existing plugin call-envelope codes in the active spec remain in their own namespace, not aliases of sentinel codes.
Cause Rules¶
Preserve trusted known framework identities before applying a generic boundary
fallback. An arbitrary user exception's code property is not automatically a
trusted framework identity. Middleware forwarding a model/tool failure retains
that classification; its own exception uses the middleware boundary. Hook or
middleware failures during cleanup retain callback classification rather than
becoming generic cleanup failures.
Catalog origin records provenance, not trust. A new classification
created by the framework is as preservable as an existing identity. SDK adapters
must establish trust using a framework-owned native type or internal record, not
a string supplied by a tool. The reference fixture's known-framework-code and
middleware-forward inputs assert that trust; they do not implement it.
operation is the original owning failure stage, not the current wrapper or
observer. Preserve it through forwarding. A multi-operation code requires explicit
context; selecting the first listed operation is invalid. Boundary labels alone
cannot establish cancellation or deadline ownership; contradictory inputs are
rejected rather than classified by generic fallback.
Go context.Canceled, Python asyncio.CancelledError, a TypeScript aborted
signal, Java cancellation/interruption and Rust cancellation state map to
AGENT_CANCELLED only when the owning execution accepts cancellation. Java
interruption alone is insufficient. Existing AGENT_ABORTED remains unchanged.
Go context.DeadlineExceeded or an execution-owned expired deadline maps to
AGENT_DEADLINE_EXCEEDED; arbitrary TimeoutError, TimeoutException, HTTP or
MCP timeouts do not establish that deadline.
An unknown remote framework code maps to EXECUTION_INTERNAL at run.execute;
keep the original code only in restricted local diagnostics. Provider HTTP/RPC
codes stay separate. Native chains remain local where supported; Rust's current
PraxoError stores code/message, not a native cause chain. Adding cause support
and versioned projections remain separate evidence. Generate constants and tests
where useful, not native control flow.
Failure Precedence¶
The first execution failure is primary. Errors from remaining result callbacks, cleanup, error reporting or sinks are secondary and cannot replace it. If there is no execution failure, a cleanup or delivery failure can be returned with its own classification. Failure to report an error must not recursively emit errors.
Execution outcome and observation delivery are separate. A sink may have accepted completion before another sink fails. Do not infer a rolled-back run from the return value of event delivery.
Effects And Retry¶
Error reason, terminal state and effect certainty are independent facts. A timeout may mean that an external write succeeded but its response was lost. Cancellation does not establish that no effects occurred. No error code by itself authorizes replay of a tool or whole run.
Do not introduce a universal retryable=true guarantee. An adapter can report
transient transport conditions, but an application must also establish effect
idempotency or verify the prior effect. Logical calls and physical retry
attempts need separate counters.
Monitoring¶
Use the same classified code/category/operation across supported language implementations. Metrics dimensions are finite; run IDs, session IDs, tool arguments, URLs, messages and provider bodies are not metric labels. User tool names are not assumed to be bounded labels. Trace/log correlation identifiers must follow the application's privacy policy.
Default exports omit arguments, credentials, raw causes and provider response bodies. Redaction occurs before projection. Test both error-code consistency and negative disclosure cases. OTel adapters map to supported semantic conventions without claiming that an exception name is the framework's stable code.
The active default projection allowlists only code, category, operation.
Messages, stacks, arbitrary details and remote codes are local-only by default;
optional diagnostic exports require separate allowlisting and redaction.
Adding fields to run.failed, stream output or plugin envelopes requires
shared-wire compatibility review and packaged-consumer tests. Do not silently
insert this active structure into existing events.