Error Model

AEP Error Model

> Status: draft. Part of the AEP 0.1 protocol specification.

Purpose

Define the standard error structure, error code taxonomy, and retryability rules used across all AEP events.

Standard Error Payload

Every AEP error uses the same structure:

{
  "code": "task_timeout",
  "message": "task task_01 exceeded the 300s deadline",
  "retryable": true,
  "details": {
    "task_id": "task_01",
    "timeout_ms": 300000,
    "elapsed_ms": 302150
  }
}
FieldTypeRequiredDescription
codestringyesMachine-readable error code
messagestringyesHuman-readable description
retryablebooleanyesWhether the caller may retry after this error
detailsobjectnoContext-specific error metadata

Error Code Taxonomy

Errors are organized by domain. Each domain has a prefix that maps to the protocol layer where the error originates.

Protocol Errors (protocol_*)

Errors that prevent normal message processing.

CodeRetryableMeaning
protocol_errornoUnspecified protocol violation
invalid_envelopenoEnvelope missing required fields or malformed
invalid_event_typenoEvent type not in registry or invalid format
unsupported_versionnoProtocol version not supported by this peer
internal_erroryesUnexpected internal processing failure

Session Errors (session_*)

Errors that affect the transport-level session.

CodeRetryableMeaning
session_errornoUnspecified session error
session_timeoutyesSession timed out (heartbeat or idle)
session_closednoSession was closed unexpectedly
unauthorizednoAuthentication or authorization failed

Subscription Errors (subscription_*)

Errors related to subscription creation or management.

CodeRetryableMeaning
subscription_errornoUnspecified subscription error
subscription_rejectednoSubscription request rejected by producer

Task Errors (task_*)

Errors during task lifecycle.

CodeRetryableMeaning
task_errornoUnspecified task error
task_timeoutyesTask exceeded its deadline
task_cancellednoTask was cancelled

Tool Errors (tool_*)

Errors from tool execution.

CodeRetryableMeaning
tool_errornoUnspecified tool execution error
tool_timeoutyesTool execution exceeded deadline

Retryability Rules

An error is retryable if the same operation might succeed on a subsequent attempt without external state changes. The rule of thumb:

Consumers may retry retryable errors. Producers should not retry non-retryable errors.

Error Propagation

Errors appear in event payloads according to the event type:

EventError Location
event.rejectedpayload.error
session.errorpayload.error
task.failedpayload.error
tool.call.failedpayload.error
subscription.rejectedpayload.error
event.dead_letteredpayload.error

Implementation Notes