ExAgent. RunError exception
(ExAgent v3.0.0)
View Source
An operational run failure with the last confirmed execution state.
Stability — Stable.
reason retains the underlying error category; partial has the same fields
as a successful run result, with output: nil and a failed/cancelled status.
Incomplete model output is in partial.pending_response, never executable
conversation history. Preserving progress does not make replay idempotent.
A keyed Server turn can return :idempotency_conflict, :idempotency_expired,
:idempotency_expiry_out_of_range or :receipt_limit directly at admission.
An indeterminate submission returns {:error, {:delivery_unconfirmed, request_id}}.
The caller can query the original intent with ExAgent.Server.receipt/2.
A missing receipt on a Server without continuations returns
{:error, :receipt_not_durable}. Reconcile after owner loss before resubmitting.
A subject fenced by ExAgent.Retention rejects a new turn with
:subject_erased. A C7 run can wrap that cause in
{:continuation_checkpoint_failed, :subject_erased}.
{:format_level_required, feature, required, active} means the Store's
active write level cannot represent the feature.
{:unsupported_store_format, feature, required, known} means the reader
needs a binary that supports the stored format. A write failure can wrap
the cause as {:continuation_checkpoint_failed, cause}.
{:store_migration_required, 4} means the SQL 4 header column or index
is missing. Apply unified migration 1, then rebuild existing run headers.
A run can wrap this cause in {:continuation_checkpoint_failed, cause}.
An operator run page can report :run_header_missing for a journal that
needs the Store's header rebuild.
{:store_migration_required, 7} means the timer index needed by a
deferral-capable tool is missing or invalid. A persisted delegation
reports the child's bounded rejection reason when the writer confirms
that the tool was refused before dispatch. If the effect remains
unconfirmed, the parent reports :execution_uncertain and the journal
retains the effect for reconciliation.
:continuation_lease_expired means the execution lost its claim. A failed
acknowledgement of a renewal returns :continuation_lease_unconfirmed.
Both give hint: :recover_continuation_lease. Read :lease_until with
ExAgent.Continuation.get/2 and recover after the Store's clock reaches
that UTC timestamp in milliseconds. Resolve any unconfirmed effects before
resuming.
Resume admission reports :continuation_conflict for a stale or invalid
v1 reference. A matching revision whose stored state cannot resume gives
{:continuation_not_ready, status}.
{:definition_unavailable, ref} means the catalogue lacks a saved version.
{:definition_incompatible, field} identifies a mismatched binding.
A guardrail decision has the reason {:guardrail_tripped, name, stage, info}.
name identifies the policy and info is its optional bounded code.
A tool-output veto leaves the effect receipt in partial with
content_withheld: true. The receipt retains its status and available usage.
A malfunctioning check returns {:capability_failed, ExAgent.Guardrail, stage, reason}.
On recovery a persisted malfunction uses the bounded reason :guardrail_check_failed.
A Frame3 run reports :continuation_guardrail_policy_changed if its bound
origin or handoff policy reference or ordered rules differ on resume.
:continuation_guardrail_control_unconfirmed means the tool effect was
confirmed and its checked return could not be recovered. The return is withheld.
:invalid_continuation_guardrail_evidence reports a certificate the writer or
reducer could not verify.
Tool guards with durable delegation or custom tool rehydration return the
tuple {:unsupported, {:guardrail, stage, boundary}} with
:agent_continuation_delegation or
:agent_continuation_rehydrate_tools as the boundary.
Classifier guards use :classifier_continuation for root agent runs and
handoffs. Workflows and durable delegates report their existing boundary.
Offering an image-producing tool or replaying one of its image results on an
unsupported model fails before dispatch with {:unsupported, :image_tool_results}.
A provider file reference with another owning provider fails before request
admission with {:model_request_failed, %ExAgent.RequestError{reason: :file_reference_provider_mismatch}}.
A Fallback checks every leaf. This rejection spends zero requests at that step.
An invalid result schema in a tool definition fails before the model request
with {:invalid_tool_schema, name, errors}. A returned value that violates a
valid result schema produces a confirmed :tool_error and the run continues.
A durable composition, flow or delegate that offers native map output or a
map union permitting text fails before requesting the model with
{:unsupported, :composition_json_output_without_tool}. Use a map output
tool or a union of output tools for these leaves.
An agent definition with ExAgent.Tool.CodeMode returns
{:unsupported, {:code_mode, :continuation}} when admitted to a persisted run.
A failure in a live tool batch can include the candidate confirmed_program_steps field with
the nested outcomes observed before the failure. Each entry includes the
one-based step, the program and nested call references, the declared effect
and the observed status. Arguments and results stay out of this evidence.
A live program whose retained binding results exceed the effective tool
return cap fails with {:retention_limit_exceeded, %{boundary: :tool_program, bytes: bytes, limit: limit}}.
A capped tool task terminated by the VM reports
{:tool_execution_failed, name, {:exit, :killed}}. The ordinary admission
and receipt rules still determine the tool status.
Live steering with a continuation returns {:unsupported, :continuation_steering}
before Store IO. A rejected correction batch at a volatile request boundary
retains the guardrail or retention reason and the preceding history.
A model response with more than one selected transfer call fails with
:multiple_handoffs before dispatching its batch. A persisted agent run
rejects a changed catalog with :continuation_handoff_catalog_changed.
:invalid_continuation_handoff reports that the journal could not certify
a transfer. :continuation_handoff_batch_failed denotes a saved fatal tool
control. :continuation_handoff_control_unconfirmed denotes a raw result
whose hook completion could not be verified. Composition, Flow, delegated
continuations and persisted Session chat return
{:unsupported, :continuation_handoff} for model-directed handoffs.
If a successor request still carries images
after a hook chooses a model without image input support, it fails with
{:unsupported, :handoff_image_input} before requesting that model.
A successor request carrying audio fails with
{:unsupported, :handoff_audio_input} if the effective model lacks audio
input support. Every Fallback candidate must support it.
A volatile Session that refuses a transfer reports {:handoff_refused, reason}.
Use partial.model for the live state of the originating model.
A provider input-window rejection has reason
{:model_request_failed, %ExAgent.RequestError{reason: :context_overflow}}.
The RequestError in reason carries the diagnostic with its model field nil.
A quota refusal gives {:rate_limited, key, wait}. The wait is a
delay in milliseconds, :infinity for an impossible reservation or
unschedulable cooldown, :queue_full, or :unknown when immediate local
admission is blocked and the limiter cannot estimate the wait. A stopped limiter gives
:rate_limiter_unavailable. An unacknowledged shared permit gives the same
error while there is time left on the attempt. A confirmed missing PostgreSQL
quota schema gives {:rate_limiter_migration_required, 1}. Apply the quota
migration on the Repo's search path. A quota reply that misses
the deadline gives :deadline_exceeded. A refusal before the first intent
adds no model request or cost. Settlement at the deadline preserves observed
usage and puts a complete provider reply in partial.pending_response. A confirmed
incomplete terminal keeps its {:incomplete_response, finish} reason.
Candidate shared account admission can return
{:usage_limit_exceeded, :budget_cents, {:retry_after_ms, wait}}. The wait
is a delay in milliseconds, :infinity when the reservation exceeds the
ceiling, or :unknown when pending charges preclude a retry estimate.
A backend that cannot confirm the reservation gives
{:accounting_unavailable, "cost", :budget_unavailable}.
A handle whose limits differ from the shared account gives
:spend_budget_policy_mismatch.
These errors prevent dispatch. Before the first attempt they leave the
request count and C7 effects unchanged.
For a workflow step refused before its next intent, the step's portable
error records the usage, deadline, quota or maximum-step reason. Rereading
a failed workflow returns {:workflow_failed, portable_error}. A durable
Job can release a certified refusal before its first intent and return a
ready or expired reference in partial.continuation.
A map Flow refuses invalid manifests before opening a continuation.
{:invalid_flow_manifest, :invalid_list} expects a proper list.
{:invalid_flow_manifest, {:invalid_item, index}} and
{:invalid_flow_manifest, {:duplicate_id, index}} point to a zero-based item.
{:flow_manifest_limit, limit} reports the configured item limit.
{:flow_manifest_bytes_limit, limit} reports the JSON byte limit.
{:workflow_tool_batch_checkpoint_limit, required_bytes, limit_bytes} reports
the journal size including closure reserves before any tool in the batch starts.
A workspace backend which cannot acknowledge a write returns
{:tool_execution_failed, name, :result_unconfirmed}. Its tool return has
status :unknown. Reconcile the effect before resuming a durable run.
An MCP HTTP header provider can fail before the tool POST with
{:tool_execution_failed, name, {:mcp_headers, cause}}, where cause is
:unavailable, :invalid or :principal_mismatch. Dropping the credential
request before upload at its deadline gives :http_pre_dispatch_timeout in
the third position. Loss of an acknowledgement after dispatch remains an
unknown effect and requires reconciliation.
A rejected MCP tool POST can carry
{:tool_execution_failed, name, {:authorization_required, challenge}}.
The third position can also carry this challenge for an unknown effect
after a rejected control POST or task poll. Check the tool return status
before retrying. See ExAgent.MCP.Client.authorization_challenge/0.
A negotiated MCP task leaves its tool outcome unknown if polling times out,
returns an invalid receipt or requires input. The third position can be
:timeout, :invalid_task_result, :mcp_task_unknown or
:mcp_task_input_required. A remote
cancellation observed by a live caller gives :mcp_task_cancelled. A
cancellation acknowledgement by itself does not settle the tool outcome.
Sandbox execution or job submission can report
{:tool_execution_failed, name, {tag, operation_id}} with
:operation_exists or :result_unconfirmed. These returns have status
:unknown. Sandbox queries report backend unavailability or a queried
execution's uncertain outcome as a bounded :tool_error.
A call to a tool with requires_deferral: true outside a compatible Frame3
continuation fails with {:tool_requires_deferral, name} and a
:not_executed return. An undeclared tool that dynamically defers there
has already run and its effect is unconfirmed.
Strict fixture admission returns {:tool_execution_failed, name, :missing_tool_stub}
when an authorized callable has no substitute, or :invalid_delegate_stub in
the third position for a mismatched durable delegation binding.
Ambiguous cassette requests fail with
{:model_request_failed, %ExAgent.RequestError{provider: :fixture, reason: {:fixture_ambiguous, details}}}.
See ExAgent.Fixture.with_label/2 for roots or siblings with identical requests.
The partial model is a live runtime value and may contain credentials. Use the message/snapshot codecs rather than exporting this struct as JSON.
RunError is an exception. ExAgent.run!/3 raises the same value that
ExAgent.run/3 returns in {:error, error}. Its message uses a bounded
projection of reason and can include a static remediation hint. When
a validator rejects output on a direct Flow branch and the chain lacks
a pure declaration, the error has hint: :flow_output_veto_requires_pure_validators.
A model missing its continuation preflight has hint: :implement_validate_resume.
Summary
Types
@type t() :: %ExAgent.RunError{ __exception__: term(), confirmed_program_steps: [ %{ program_call_ref: String.t(), call_ref: String.t(), step: pos_integer(), effect: ExAgent.Tool.effect(), status: :succeeded | :tool_error | :failed } ], hint: :flow_output_veto_requires_pure_validators | :implement_validate_resume | :recover_continuation_lease | :configure_model_codec | :inspect_output_schema | nil, output_failure: %{schema: String.t(), attempts: pos_integer(), paths: [String.t()]} | nil, partial: ExAgent.Result.t() | ExAgent.Coordination.result(), reason: term() }