Skip to main content
A contract failure returns a numeric code, such as Error(Contract, #<code>). The number has meaning only within the emitting contract’s error enum.

Identify the error source

Use the contract address associated with the final error diagnostic to select the decoder. Follow nested calls when a pool, token, router, or oracle fails. The address called at the top level is not enough. An earlier diagnostic can also describe a caught failure that is not the final error. Keep the final error domain, code, emitter address, and diagnostic trace. If the trace does not identify the emitter, report the numeric code as unresolved. Do not infer a contract from the number alone. For example, lending #401 means FlashloanNotEnabled; the DeFindex adapter’s #401 means NotInitialized. The enums have explicit discriminants. Gaps are expected. Recheck decoders after an upgrade. Host, authorization, dependency, and token failures need their own decoders. The swap aggregator and XOXNO oracle have separate enums.

Groups

Generic errors

Codes 1 (AssetNotSupported), 3 (InvalidTicker), 11 (InvalidExchangeSrc), and 12 (PairNotActive) are declared but have no error sites in the lending contract source.

Collateral and pool errors

Code 110 (PositionNotFound) is declared but has no error site in the lending contract source. An account owner may call liquidate on that account. #133 only rejects using the same account as the SeizeMode::Credit(id) receiver.

Spoke errors

Oracle errors

Price failures reach users indirectly: price-aggregator prices and price_spread panic on an unusable price, as do controller paths requiring that valuation. quotes reports per-key resolution failures as PriceStatus { valid: false, error_code: Some(...) }; this does not suppress host failures such as exhausted resources.

Flash loan and strategy errors

DeFindex strategy adapter errors

The reference vault adapter uses its own enum, independent of the codes above.

Integration handling

  • Treat oracle errors as retryable only after source recovery or configuration change. See the oracle disruption runbook.
  • Treat cap, liquidity, and utilization errors (#112, #127, #311, #312) as amount/headroom problems.
  • For authorization and listing errors, check the caller, account owner, delegate status, full market key, and current listing flags.
  • For #319, read the current epoch and schedule a new recovery operation. Do not retry the stale operation unchanged.
  • Treat the five *RoundsToZeroShares codes as “amount too small for this market’s current index” — increase the amount.
  • Use views to check the request. Simulate the exact call with the same addresses, amounts, and arguments. The execution result is authoritative.