Skip to main content
Anchor program errors surface as numeric codes in transaction logs. Kimia’s Codama-generated clients turn them into typed enums, but you still need a strategy for:
  • Detecting which program the error came from
  • Mapping it to a user-facing message
  • Deciding between retry, prompt, or give-up

Shape of an Anchor error in logs

Kimia clients parse the Error Number and the emitting program ID to route errors to the right enum.

Parsing helper

See frontend/app/lib/errors.ts for the full mapping the reference UI uses.

Error categories by program

kimia-perp (6000..6199)

delta-vault

split-engine

yield-amm

intent-router

Retry policy

Auto-retryable errors:
  • StaleOracle, re-fetch Hermes, rebuild tx, retry.
  • RPC transient errors (connection, blockhash not found), exponential backoff.
User-prompt errors:
  • SlippageExceeded, ask the user to raise slippage tolerance.
  • InsufficientFreeCollateral, prompt a deposit or cancel-orders flow.
Give up / show error:
  • MarketNotActive, VaultNotActive, nothing the user can do until admin.
  • Math errors (MathOverflow), your input was too large; don’t retry.

Logging raw errors

For unknown or unmapped errors, log:
  • Transaction signature
  • Program logs (tx.meta.logMessages)
  • Which instruction in the tx failed (Anchor logs Instruction: X)
Include these three artefacts in any bug report.