Skip to content
Version v0.1 (draft)
ChangelogContributing

Reference

Error codes

Rejection codes in decisions and HTTP error codes from the services.

A2M reports failures in two places:

  • In a signed decision. A rule that fails produces a REJECT decision whose code and message name the rule. This is a normal, attributable answer, not a transport error. Over MCP it is returned as a tool result the model can read.
  • As an HTTP error. Malformed requests, conflicts, executor refusals and outages return an HTTP status and a body:
{ "error": { "code": "A2M_BAD_SIGNATURE", "apex_code": null, "category": "validation", "message": "decision signature did not verify" } }

category is validation or operational. apex_code is an optional secondary code aligned with the error classes of the draft APEX agent-venue specification, where one applies. A 4xx other than 408 and 429 will not succeed on retry.

Code Secondary Meaning
A2M_AGENT_UNKNOWN APEX_4002 Agent is not registered
A2M_AGENT_REVOKED APEX_4002 Agent is revoked
A2M_MANDATE_INACTIVE APEX_4002 Mandate is missing, revoked or expired
A2M_MANDATE_AMBIGUOUS APEX_4002 More than one live mandate; fail closed
A2M_INSTRUMENT APEX_4010 Instrument not on the mandate allowlist
A2M_VENUE APEX_4011 Venue not on the mandate allowlist
A2M_INSTRUMENT_UNKNOWN APEX_4010 Instrument not listed on the venue
A2M_INSTRUMENT_HALTED APEX_4030 Instrument is halted or not tradable
A2M_UNSUPPORTED_PRODUCT APEX_4010 Product class has no risk treatment yet; fail closed
A2M_UNIT_INACTIVE APEX_4011 No active protected unit for this venue and product
A2M_ORDER_TYPE APEX_4011 Broker does not accept this order type
A2M_TIME_IN_FORCE APEX_4011 Broker does not accept this time in force
A2M_ACCOUNT_UNKNOWN APEX_4002 User has no account at the venue
A2M_ACCOUNT_INACTIVE APEX_4002 Account is not active
A2M_MARKET_CLOSED APEX_4030 Instrument session is closed
A2M_STALE_PRICE APEX_4024 Reference price missing, invalid, stale or in the future
A2M_LOT_SIZE APEX_4011 Quantity is not a whole number of lots
A2M_TICK_SIZE APEX_4011 Limit price is not on the tick
A2M_PRICE_BAND APEX_4011 Limit is outside the market price band
A2M_PRICE_COLLAR APEX_4011 Limit missing or outside the mandate price collar
A2M_BROKER_NOTIONAL APEX_4011 Notional below the broker minimum or above the maximum
A2M_FAT_FINGER_QTY APEX_4011 Quantity not positive or above the mandate cap
A2M_FAT_FINGER_NOTIONAL APEX_4011 Notional above the mandate cap
A2M_KILL_HALT APEX_4023 Kill switch is set to halt
A2M_REDUCE_ONLY APEX_4023 Order would not reduce, or the account is reduce-only
A2M_DAILY_LOSS APEX_4022 Daily loss limit reached; only reducing orders pass
A2M_SHORT_DISABLED APEX_4021 Order would open or extend a short, or flip through flat
A2M_POSITION_LIMIT APEX_4021 Projected position above the mandate limit
A2M_MAX_OPEN APEX_4021 Too many open orders
A2M_RATE_LIMIT APEX_4040 Order rate limit reached
A2M_BUYING_POWER APEX_4020 Buying power below the required reservation
A2M_BUDGET APEX_4020 The mandate’s budget cannot cover the reservation
A2M_ACCOUNT_CASH APEX_4020 Broker cash unknown or insufficient

An approval that ends without an executable decision carries A2M_APPROVAL_DENIED (a human declined) or A2M_APPROVAL_EXPIRED (nobody answered in time).

Code HTTP Meaning
APEX_4001 401 Bearer token missing or invalid
APEX_4011 400 Intent is malformed (for example an unknown time_in_force or a JSON number in a money field)
A2M_IDEMPOTENCY 409 intent_id reused for a different order
A2M_BAD_SIGNATURE 422 Decision signature did not verify
A2M_BAD_DECISION 422 Decision payload is malformed or uses an unknown version or field
A2M_NOT_AUTHORIZED 422 / 404 / 409 Decision is not executable, or unknown
A2M_ENFORCEMENT 422 Enforcement mode not supported by this executor
A2M_DECISION_EXPIRED 422 Decision expired before send
A2M_DECISION_CONSUMED 409 Decision was already sent
A2M_NO_ROUTE 422 Executor has no connection to the venue
A2M_ORDER_TYPE, A2M_TIME_IN_FORCE 422 Venue capabilities do not include this order type or time in force
A2M_VENUE_DOWN 503 Venue unavailable, or capabilities unreadable; fail closed
A2M_ORDER_STATE 409 / 404 Illegal state transition, or unknown order
A2M_BLIND_RESEND 409 Refusing to resend after an unknown or in-flight submit
A2M_APPROVAL 404 / 409 Unknown approval, or already decided
A2M_RATE_LIMIT 429 Too many requests for this credential
A2M_UPSTREAM 503 A service behind the gateway is unavailable
A2M_INTERNAL 500 Internal error

Control-plane codes (A2M_TENANT, A2M_USER, A2M_ACCOUNT, A2M_OAUTH_BINDING, A2M_RESERVATION, A2M_EVIDENCE) are implementation-specific and not part of v0.1.