Reference

Errors

Every error the Civitas program and API return: its number or HTTP status, its message, and what raises it.

Program errors

Custom errors start at 6000. A failed transaction names the error on its first Program … failed line for the Civitas program ID; the API returns it as programError.name with CHAIN_REFUSED. The sample economy refuses with the same names.

NumberHexName
60000x1770AgentFrozen
60010x1771AgentRevoked
60020x1772PolicyExpired
60030x1773AuthorizationExpired
60040x1774PayeeNotAllowed
60050x1775OverPerCallLimit
60060x1776OverPeriodCap
60070x1777NonceReplayed
60080x1778BadSignature
60090x1779BadConsent
60100x177aConsentExpired
60110x177bFeeMismatch

AgentFrozen

6000 · The principal froze this agent.

The payer’s principal froze it. Unfreezing lets the same authorization settle if it hasn’t expired.

Raised by settle.

AgentRevoked

6001 · The principal revoked this agent.

The agent, or the payee agent in settle, was revoked.

Raised by deposit, withdraw, set_policy, freeze, unfreeze, revoke, list_service, unlist_service, settle.

PolicyExpired

6002 · The spending policy has expired.

The clock reached the policy’s expires_at. A new policy with a later expiry clears it.

Raised by settle.

AuthorizationExpired

6003 · The payment authorization has expired.

The clock reached the authorization’s expires_at. The agent signs a new one.

Raised by settle.

PayeeNotAllowed

6004 · The policy does not allow this payee.

The policy has an allowlist and the payee isn’t on it.

Raised by settle.

OverPerCallLimit

6005 · The amount and fee exceed the per-call limit.

Amount plus fee is above max_per_call.

Raised by settle.

OverPeriodCap

6006 · The amount and fee exceed the remaining period allowance.

This charge would take the period’s spending above max_per_period.

Raised by settle.

NonceReplayed

6007 · This nonce was used or is below the replay window.

The nonce settled before, or it is 256 or more below the highest nonce settled.

Raised by settle.

BadSignature

6008 · The preceding Ed25519 instruction does not verify this authorization.

No Ed25519 instruction sits just before settle, or its key or message is not the agent’s authorization. A signature that fails cryptographically is refused earlier, by the Ed25519 program itself.

Raised by settle.

BadConsent

6009 · The preceding Ed25519 instruction does not verify this charter consent.

No Ed25519 instruction sits just before charter, or its key or message is not the agent key’s consent to this principal, card hash and expiry.

Raised by charter.

ConsentExpired

6010 · The charter consent has expired.

The clock reached the consent’s expiry before the charter landed. The agent key signs a new consent.

Raised by charter.

FeeMismatch

6011 · The signed fee does not match the configured fee for this payment.

The fee in the signed authorization isn’t the fee the program’s config gives for the amount, which happens when the fee terms changed after the quote. The agent signs again against a fresh quote.

Raised by settle.

API errors

Every failed response carries one envelope, { "error": { "code", "message", "retryable", "stage", … } }, whatever its HTTP status. Branch on code. The envelope’s fields are under ApiError.

CodeHTTPWhen
VALIDATION_ERROR400A request field failed its schema, and fieldErrors names each one. Builds also answer it for a request the state can’t satisfy: a key that already has a charter, a withdrawal over the vault balance.
UNAUTHORIZED401The route needs a session and the request carries no valid Authorization: Bearer token.
ORIGIN_NOT_ALLOWED403The request’s Origin is not one the API allows.
NOT_FOUND404No such agent, settlement, receipt, card, build or sample session.
PROGRAM_UNAVAILABLE409The API is waiting for the program on its cluster. Retry later.
CONFIGURATION_REQUIRED409A value the route needs is not configured on this API yet.
IDEMPOTENCY_CONFLICT409The build was already submitted under another idempotency key, or a different receipt already carries this signature or is linked to this settlement.
TRANSACTION_EXPIRED409The build’s blockhash expired before the transaction landed. Build it again.
PAYLOAD_TOO_LARGE413The request body is over the route’s limit.
UNSUPPORTED_MEDIA_TYPE415The body is not application/json.
SIMULATION_FAILED422The built transaction failed simulation. programError names the program error when there is one.
CHAIN_REFUSED422The program refused the transaction. programError.name is one of the program errors above.
RATE_LIMITED429Too many writes from this client this minute. retryAfterSeconds says when to retry.
INTERNAL_ERROR500The API failed. requestId identifies the request.
UPSTREAM_UNAVAILABLE502The chain or the sample economy can’t be reached.
FORBIDDEN403The session wallet is not the agent’s principal.
INVALID_RECEIPT422The receipt’s signature doesn’t verify against the payee key it names, or its call ID, payer, payee or amount isn’t the settlement’s.

Stages

stage says where the flow failed.

StageWhere
validationThe request’s fields.
authThe session or the principal check.
readReading state.
uploadStoring a card or receipt.
buildBuilding a transaction.
walletThe wallet signing.
co_signThe API co-signing.
simulationSimulating the signed transaction.
sendSending it.
confirmationWaiting for it to land.