Technical Edge Cases

What happens when a capability fails?

When a capability fails, Traverse transitions the state machine to the error state, returns a structured error to the caller, and records a trace artifact with the failure details. The error is typed — it tells you whether the failure happened at input validation, during execution, or at output validation. You can debug from the trace without rerunning the call.

Three points of failure

There are three places a capability call can fail in Traverse:

  • Precondition failure. The input does not match the contract schema. The WASM binary never runs. The state machine stops at evaluating_constraints and returns a validation error with the specific field that failed.
  • Execution failure. The WASM binary runs but returns an error code or panics. The runtime catches this, records the execution failure, and transitions to the error state. The output is not returned.
  • Postcondition failure. The capability ran and produced output, but the output does not match the contract schema. This means the capability violated its own contract. The runtime rejects the output and returns a postcondition error. The trace records both the raw output and the schema violation.

What callers receive

The MCP tool call returns an error response. The error includes a type field indicating which stage failed, a human-readable message, and where applicable the specific field or constraint that was violated. Callers can inspect this and decide how to handle it — retry with corrected input, surface to a user, or escalate.

The trace artifact on failure

Every failed call still produces a trace artifact. The trace records the input, the failure type, the error details, and the timestamp. For postcondition failures it also records the raw output that was rejected. This means you can audit any historical failure without rerunning it. See what is a trace artifact for more.

Partial failures in AI pipelines

When an AI agent calls a capability and it fails, the agent receives the structured error. A well-designed agent should treat a precondition failure as a signal to fix its input and retry, and treat a postcondition failure as a signal to stop and surface the issue rather than proceed with bad data. This is one of the core safety properties that contracts give you in AI pipelines.

See how Traverse handles errors and how Traverse prevents AI agent errors for the broader picture.