MACP Error Code Registry

Defines machine-readable error identifiers used by MACP runtimes.

Identifier Format

UPPER_SNAKE_CASE

Standard Error Codes

CodeDescriptionHTTP StatusgRPC StatusStatusReference
UNAUTHENTICATEDAuthentication failed401UNAUTHENTICATEDpermanentRFC-MACP-0004
FORBIDDENAuthenticated sender is not authorized for the session, message type, role, or claimed authority (see RFC-MACP-0002 §6.1 for the Mode-rule mapping)403PERMISSION_DENIEDpermanentRFC-MACP-0004, RFC-MACP-0002
SESSION_NOT_FOUNDSession does not exist404NOT_FOUNDpermanentRFC-MACP-0001
SESSION_NOT_OPENSession is not OPEN (resolved, expired, cancelled, or suspended)409FAILED_PRECONDITIONpermanentRFC-MACP-0001
DUPLICATE_MESSAGEmessage_id already accepted within the session409ALREADY_EXISTSpermanentRFC-MACP-0001
SESSION_ALREADY_EXISTSSession already has an accepted SessionStart for this session_id409ALREADY_EXISTSpermanentRFC-MACP-0001
INVALID_ENVELOPEEnvelope validation failed, payload did not satisfy the required structural contract, or a session-scoped message breached the bound Mode's validation rules (sender-authorization breaches use FORBIDDEN; see RFC-MACP-0002 §6.1)400INVALID_ARGUMENTpermanentRFC-MACP-0001, RFC-MACP-0002
UNSUPPORTED_PROTOCOL_VERSIONNo mutually supported protocol version exists, or an envelope uses an unsupported negotiated version400INVALID_ARGUMENTpermanentRFC-MACP-0001
MODE_NOT_SUPPORTEDThe referenced coordination mode or mode version is not supported for new sessions400INVALID_ARGUMENTpermanentRFC-MACP-0002
PAYLOAD_TOO_LARGEPayload exceeds allowed size413RESOURCE_EXHAUSTEDpermanentRFC-MACP-0001
RATE_LIMITEDToo many requests429RESOURCE_EXHAUSTEDpermanentRFC-MACP-0004
INVALID_SESSION_IDsession_id format does not meet deployment requirements (e.g., not a valid UUID or base64url token)400INVALID_ARGUMENTpermanentRFC-MACP-0001
INTERNAL_ERRORUnrecoverable internal runtime error (e.g., storage failure); clients SHOULD retry or escalate500INTERNALpermanentRFC-MACP-0001
UNKNOWN_POLICY_VERSIONpolicy_version not found in policy registry at SessionStart404NOT_FOUNDpermanentRFC-MACP-0012
POLICY_DENIEDCommitment rejected because governance policy rules are not satisfied403PERMISSION_DENIEDpermanentRFC-MACP-0012
INVALID_POLICY_DEFINITIONPolicy descriptor fails validation (bad JSON, schema mismatch, mode mismatch)400INVALID_ARGUMENTpermanentRFC-MACP-0012
REGISTRY_READ_ONLYA registry mutation (RegisterPolicy, UnregisterPolicy, RegisterExtMode, UnregisterExtMode, PromoteMode) was refused because this runtime's registry is not mutable over the API (for example, policies loaded from deployment configuration)409FAILED_PRECONDITIONpermanentRFC-MACP-0012, RFC-MACP-0002
INVALID_REQUESTA control-plane request that is not an Envelope failed validation (for example, a negative page_size, an unparseable page_token, or a missing descriptor); Envelope failures use INVALID_ENVELOPE400INVALID_ARGUMENTpermanentRFC-MACP-0006
STREAM_LAGGEDA server-stream subscriber (StreamSession, WatchSessions, WatchSignals) fell behind and the runtime dropped events for it; the stream ends, and the client SHOULD resubscribe and SHOULD NOT assume it observed every event503RESOURCE_EXHAUSTEDpermanentRFC-MACP-0006
AGENT_NOT_FOUNDGetManifest named an agent_id this runtime does not host404NOT_FOUNDpermanentRFC-MACP-0005
HISTORY_UNAVAILABLEThe accepted history a request needs is no longer held: WhatIfReplay named a session whose full accepted history the runtime no longer holds (for example, its log was compacted into a checkpoint when it ended), so no report can be produced; or a StreamSession subscribe asked to resume at an after_sequence below the compacted base. For a resume, details is the UTF-8 JSON text {"lowest_available_sequence": N} on every binding (base64 in JSON form)409FAILED_PRECONDITIONpermanentRFC-MACP-0012, RFC-MACP-0006
RECEIPT_UNAVAILABLEGetDecisionReceipt named a session for which no decision receipt can be issued: it is not RESOLVED, it resolved without a CommitmentPayload, or no receipt could be issued409FAILED_PRECONDITIONpermanentRFC-MACP-0013
UNAUTHORIZEDHistorical alias for FORBIDDEN; new implementations SHOULD use FORBIDDEN403PERMISSION_DENIEDdeprecatedRFC-MACP-0004

The gRPC Status column is the status code the gRPC binding MUST use when it surfaces a MACP error code as an RPC status (RFC-MACP-0006 §3). It is aligned with the HTTP Status column: 401 maps to UNAUTHENTICATED, 403 to PERMISSION_DENIED, 404 to NOT_FOUND, 400 to INVALID_ARGUMENT, 413 and 429 to RESOURCE_EXHAUSTED, and 500 to INTERNAL. 409 splits by cause: a lifecycle or state conflict (SESSION_NOT_OPEN, HISTORY_UNAVAILABLE, RECEIPT_UNAVAILABLE) maps to FAILED_PRECONDITION, and an existence conflict (DUPLICATE_MESSAGE, SESSION_ALREADY_EXISTS) maps to ALREADY_EXISTS. The deprecated alias UNAUTHORIZED maps to PERMISSION_DENIED, the same status as the FORBIDDEN code it aliases. One code departs from the HTTP alignment: STREAM_LAGGED is HTTP 503, because the server shed the subscriber and the client did nothing wrong, but it is gRPC RESOURCE_EXHAUSTED, because a per-subscriber buffer was exhausted. That is the status gRPC clients of existing runtimes already receive, and UNAVAILABLE would wrongly invite a transparent retry of the same call.

Stability of Permanent Codes

Runtimes, SDKs and embedders map these codes onto their own wire formats and client logic, so a permanent entry is a compatibility promise:

  • A permanent code MUST NOT be renamed or removed.
  • Its HTTP Status and gRPC Status mappings MUST NOT change.
  • Its description MAY be clarified, but MUST NOT be narrowed so that a condition it covered moves to a different code.

A code that is superseded becomes deprecated and stays in this table, as UNAUTHORIZED has, so that recorded histories and older clients still resolve it. provisional codes carry no such promise until they are promoted.

Error Design Principles

Errors should:

  • be stable across versions
  • avoid leaking sensitive system details
  • be machine-readable
  • distinguish protocol version negotiation failures from envelope-shape failures
  • distinguish unsupported modes from generic invalid-envelope rejections