Errors

This is the canonical list of error codes the Arcade Cafe API returns and the recommended agent reaction for each. Codes are stable; HTTP status is the secondary signal.

REST Error Envelope

{
  "error": {
    "code": "GAME_INPUT_REJECTED",
    "message": "Bet exceeds balance.",
    "details": {}
  }
}

details is optional. 402 payment errors also include x402 negotiation fields (accepts, x402Version) at the top level so the client can resubmit with a valid payment payload.

MCP Error Envelope

MCP tool calls that fail at the tool layer return:

{
  "error": "Agent bet exceeds 0.05 USDC.",
  "limits": { "maxBet": 0.05, "maxWagered": 1, "wagered": 0.04 }
}

MCP tool calls that fail at the underlying HTTP layer (paid plays, x402 negotiation) preserve the REST { error: { code, message, details? } } envelope inside structuredContent and set isError: true on the tool result.

Codes

CodeHTTPWhereMeaningWhat the agent should do
MISSING_WALLET400GET /api/wallet/challengewallet query parameter was omitted.Resend with ?wallet=<address>.
INVALID_WALLET_ADDRESS400wallet routesValue is not a valid Solana public key.Stop and surface the address to the user; do not retry.
INVALID_WALLET_SESSION_REQUEST400POST /api/wallet/sessionBody is missing walletAddress, message, or signature.Resend a complete body.
WALLET_SESSION_REJECTED401POST /api/wallet/sessionSignature did not verify or the challenge expired.Fetch a new challenge and re-sign.
WALLET_SESSION_REQUIRED401any wallet-owned routeBearer wallet-session token is missing or expired.Re-run the wallet-challenge → wallet-session flow and resend with Authorization: Bearer ….
X402_PAYMENT_REQUIRED402paid play routesNo payment-signature on a paid route. Response body includes accepts and x402Version.Build an x402 payload for the listed accepts[0] and resend with payment-signature: <payload>.
X402_PAYMENT_VERIFICATION_FAILED402paid play routesFacilitator rejected verify.Do not retry the same payload. Mint a fresh x402 payment and resubmit.
X402_PAYMENT_SETTLEMENT_FAILED402paid play routesFacilitator rejected settle after a passing verify.Same as above — fresh payment, fresh request. Treat the original wager as not accepted.
X402_PAYER_MISMATCH403paid play routesThe x402 payer wallet does not match the bearer wallet session.Stop. The session and payment must be for the same wallet.
X402_CONFIG_ERROR500paid play routesServer is misconfigured.Stop; this is not a client problem.
INVALID_BET_AMOUNT400Protocol V1 play (prepare) and x402-depositwager/amount is not a positive finite number.Fix the request body; do not resubmit until the value is valid.
GAME_INPUT_REJECTED400game routesGame engine rejected the play. Common reasons: bet exceeds balance, possible payout exceeds bankroll maxPayout, sweeper ticket already active, out-of-order sweeper choice, no active ticket to cash out.Read message. Most cases require changing inputs (lower bet, different mode) or refreshing session state. Do not blind-retry.
RECEIPT_NOT_FOUND404GET /api/receipts/:idNo receipt exists for that id.Stop polling this id. If the id came from a paid call that timed out, the play likely did not settle; re-check after a short delay before assuming loss.
MCP_PAYMENT_FAILED/api/mcpMCP could not parse the inner HTTP error envelope on a paid tool call.Treat as X402_PAYMENT_VERIFICATION_FAILED. Mint a fresh payment.

Agent Tool Limits

The MCP tool layer also enforces per-wallet agent caps. These do not use the coded REST envelope; they return the MCP envelope above with HTTP-equivalent status:

  • 400 Agent bet exceeds 0.05 USDC. — reduce betAmount to ≤ limits.maxBet.
  • 429 Agent wager limit reached. — wait for the limit window to roll over or fall back to read-only tools. The current limits.wagered is returned with the error so the agent can see how close it was.

Call get_arcade_state to read live limits before sizing a paid play.

Retry Rules

  • Never auto-retry a paid call after a network error. The play may have settled. Re-check GET /api/receipts/:id with any receipt id you saw, or call get_arcade_state and inspect recent activity, before sending a second wager.
  • Always mint a fresh x402 payment for any retry. A facilitator that has already seen a payment payload will reject a duplicate.
  • `GAME_INPUT_REJECTED` is terminal for that input. Treat it as a validation failure, not a transient error.
  • `401` / `403` are terminal for that token. Re-authenticate; do not loop.