Every custom error privium_pool raises, with the instructions that raise it and the check behind it. Instructions lists the checks of each instruction a user sends in order, and every other instruction’s checks by group.
| Code | Name | Message | Raised when |
|---|---|---|---|
| 6000 | Accounts |
Invalid accounts | An account differs from what the program derives or records: an AssetState's mint, token program, vault shard or queue; a vault not owned by the Pool authority or with a delegate or close authority; the fee recipient's token account (commit); a remaining-account count (open_crossing, commit, escape_claim); a recorded fill's or consolidation's mint missing from the Commit's entries; a recipient not owned by the destination; the Escape's Crossing address; admit_asset's vault addresses or two equal queues; a deposit shard above 1. |
| 6001 | Unauthorized |
Unauthorized | initialize: program_data is not the program's ProgramData, or its upgrade authority is not admin. propose_measurement: the same check against authority, read at the proposal. create_shard, admit_asset: admin is neither PoolConfig.admin nor PoolConfig.admission_authority. admit_platform with dev: the Registry's development gate is closed. rotate_council: fewer than t of the current members' signer keys signed. |
| 6002 | Configuration |
Invalid configuration | A parameter outside its fixed value or range (initialize, set_fee_rate, set_escape_window, initialize_registry, initialize_council); the default key in set_admin, set_admission_authority or set_fee_recipient, or a zero key in stage_enclave; configure_verifier a second time or with a malformed key; admit_platform by proof before configure_verifier; register_enclave with all four Registry slots admitted and unexpired and none of them the platform's for that epoch; propose_measurement with a zero digest; activate_measurement with eight measurements in the Registry; rotate_council for an epoch other than the next or with another Council key, or a new set outside initialize_council's ranges; a council_log payload over 2,048 bytes. |
| 6003 | Math |
Arithmetic overflow | A checked add or subtract overflowed: a vault that fell across deposit or a route, a cumulative total, a lease or window end, a key validity bound, or committed Exits released below zero. |
| 6004 | EscapeActive |
Escape active | deposit, open_crossing, consolidate_vault, route_residual, commit or rotate_council while the Escape is active. |
| 6005 | NotEscape |
Escape not active | refund_deposit, escape_request or escape_claim while no Escape is active. |
| 6006 | OutOfOrder |
Out of order | open_crossing for a k other than LedgerRoot.k + 1, before Δ slots have passed since the last Commit, or on a committed Crossing. consolidate_vault, route_residual on a Crossing that is not the open one. commit whose signed k, argument k, stored k + 1 or epoch disagree. |
| 6007 | StaleRoot |
Stale root | commit whose prior root is not LedgerRoot.root. |
| 6008 | MissingSig |
Missing precompile signature | No instruction before, or the one before is not the expected precompile: Ed25519 for open_crossing, consolidate_vault, route_residual, commit; secp256r1 for verify_enclave_qe, register_enclave. |
| 6009 | BadSigLayout |
Invalid signature layout | The precompile instruction verifies other than one signature, or an offset points outside it or away from the fixed positions: signature at 16, key at 80, message from 112 (Ed25519) or 113 (P-256) to the end. |
| 6010 | UnknownEnclave |
Unknown enclave | The Ed25519 key is not an admitted key in the Registry. |
| 6011 | KeyExpired |
Enclave key expired | The current slot is outside the signing key's validity interval. stage_enclave, register_enclave: a key epoch other than the current or the next. |
| 6012 | Message |
Invalid signed message | A signed message's domain tag, program id, epoch, Crossing, relayer, mint, amount or length is wrong, or a consolidation amount is zero (open_crossing, consolidate_vault, route_residual, commit). post_intent with a blob neither 208 nor 4,144 bytes. |
| 6013 | NotOpener |
Not the Crossing opener | consolidate_vault, route_residual, commit: the signer is not the Crossing's opener, signs under another epoch, or the lease has passed. open_crossing: a reopen before the lease passes while the opener's key is still admitted and current in the Registry. |
| 6014 | Price |
Price is stale or invalid | open_crossing: a price account other than the Pyth push oracle's shard-0 account for the asset's feed, not owned by the Pyth receiver, not a fully verified PriceUpdateV2, or for another feed than the asset's. route_residual: a mid recorded for the input or output mint is invalid. |
| 6015 | MidsMismatch |
Mids mismatch | open_crossing: SHA256 of the price inputs differs from the signed hash; on a reopen, the mid count or the recorded price inputs differ. commit: the signed mids hash differs from CrossingState's. |
| 6016 | FillsMismatch |
Fills mismatch | commit: the signed fills hash differs from the fills route_residual recorded. |
| 6017 | DaMismatch |
Data availability mismatch | log_diff: a committed Crossing, an index other than the next, or a chunk empty or over 3,800 bytes. commit: a committed Crossing, no chunk posted, or a DA root other than the accumulator. |
| 6018 | DepositsMismatch |
Deposit digest mismatch | commit: the signed deposits digest differs from the hash of the queues' chain hashes at the cuts. |
| 6019 | Cut |
Invalid deposit cut | commit: a queue of another mint or shard, or a cut below the credited one, past the head, or 512 or more entries behind the head. |
| 6020 | Conservation |
Conservation check failed | commit: an asset's two vault shards, after the fee payment, differ from T + X + uncredited deposits, or the commitment equation fails. release_exit, refund_deposit, escape_claim: the shards cannot cover the payment. consolidate_vault: shard 1 fell by other than the amount, or shard 0 rose by more. escape_claim: the amount exceeds the asset's Ledger total, the total is zero, or the frozen fills' spend of the asset with the open Crossing's consolidation loss exceeds it. |
| 6021 | ResidualExpired |
Residual expired | route_residual after the signed deadline slot. |
| 6022 | RouteMismatch |
Route differs from signed route | route_residual: SHA256 of Jupiter's program id, the instruction data and the remaining account keys differs from the signed route hash. |
| 6023 | Slippage |
Residual execution outside signed limits | route_residual: the route spent more than the signed input or received less than the signed minimum. |
| 6024 | RouteCap |
Residual exceeds committed balance | route_residual: eight fills already, the pair already routed in this Crossing, or the Crossing's spend of the input asset, with what a consolidation of it lost in this Crossing, above its Ledger total. consolidate_vault: eight consolidations already, an amount above the asset's Ledger total, or the Crossing's routed spend of the asset plus the transfer fee the move lost above that total. |
| 6025 | QueueFull |
Deposit queue full | deposit while the shard's queue holds 512 uncredited entries. |
| 6026 | NoteTooLong |
Note length invalid | deposit with a zero amount, or a note under 48 or over 1,024 bytes. |
| 6027 | Extension |
Token extension unsupported | admit_asset: the mint carries a permanent delegate, non-transferable, default account state, confidential mint-burn or unlisted extension, or a transfer hook other than the admitted one. |
| 6028 | Proof |
Invalid proof | A proof or point fails: admit_platform's Groth16 proof or its length; release_exit's path, or no exits root for k in the ring; escape_request's leaf, path or owner tag; a key or commitment that is not a valid ristretto255 point, or a non-canonical scalar; Council verification keys that do not interpolate to H. |
| 6029 | AlreadyPaid |
Already paid | refund_deposit on an entry already refunded. |
| 6030 | NotReady |
Exit not released yet | release_exit before its release slot or with a zero amount. trigger_escape while the Escape is active, or at a slot not past the last Commit's slot plus W. reset_escape with no Escape active, or after the first Commit. |
| 6031 | QuoteFormat |
Invalid quote | verify_enclave_qe: a QE report other than 384 bytes. register_enclave: a quote other than 632 bytes, or not version 4 with an ECDSA P-256 attestation key and TEE type TDX. |
| 6032 | Stage |
Invalid attestation stage | verify_enclave_qe on an EnclaveKey not at stage 0. register_enclave on one not at stage 1, or with an expired Platform. |
| 6033 | Platform |
Invalid platform | admit_platform: a PCK hash mismatch, a PCK not compressed, a TCB status other than UpToDate, or expired collateral. stage_enclave, verify_enclave_qe: an expired Platform. verify_enclave_qe: a P-256 key other than the PCK, or MRSIGNER, ISVPRODID or ISVSVN outside the Platform's. register_enclave: a TEE TCB SVN component below the floor. |
| 6034 | Measurement |
Invalid measurement | register_enclave: the quote's measurement is not in the Registry. |
| 6035 | ReportData |
Invalid report data | stage_enclave: the anchor slot is not in SlotHashes. verify_enclave_qe: the QE report data's last 32 bytes are not zero. register_enclave: the quote's report data differs from the staged value. |
| 6036 | AkBinding |
Invalid AK binding | register_enclave: SHA256 of the attestation key and QE authentication data differs from the hash in the QE report. |
| 6037 | AkEncoding |
Invalid AK encoding | register_enclave: the compressed attestation key's prefix does not match the parity of ak_y. |
| 6038 | DebugTd |
Debug enclave prohibited | register_enclave: the TD's DEBUG attribute is set. |
| 6039 | OwnerFields |
Owner fields must be zero | register_enclave: MRCONFIGID, MROWNER, MROWNERCONFIG or RTMR3 is not zero. |
| 6040 | Share |
Invalid re-encryption share | escape_share: the re-encryption proof fails against the member's verification key, or the posted members cannot be combined. |
| 6041 | ClaimProof |
Invalid claim proof | escape_claim: the claim proof does not verify for the amount and destination. |
| 6042 | RequestState |
Invalid request state | escape_share: another Council epoch, a combined or claimed request, a member out of range, or one who already posted. escape_claim: a request not combined, or already claimed. |
| 6043 | MeasurementPending |
Measurement activation is still timelocked | activate_measurement before the proposal's activation slot. |
| 6044 | MeasurementExists |
Measurement is already active | propose_measurement for a measurement the Registry admits; activate_measurement on a proposal already activated, or for a measurement the Registry already admits. |
| 6045 | PlatformRenewal |
Platform renewal must extend the existing collateral expiry | admit_platform on an existing Platform: the new proof's collateral expiry is not later than the recorded one, or its PCK, verifier or development classification differs from the record. |
| 6046 | ConsolidationReplay |
Vault has already been consolidated in this Crossing | consolidate_vault for a mint already consolidated in this Crossing. |
Reading a failure#
A failed instruction reports { "InstructionError": [index, { "Custom": code }] }, and its logs carry Program <id> failed: custom program error: 0x<hex>. The code is 6000 plus the error’s position in the table: 0x1770 is 6000, Accounts.
Every Anchor program numbers its errors from 6000, so a code means something only together with the program that raised it. The raiser is the program on the first failed: custom program error line of the logs; each caller up the stack fails after it with the same code. A failure inside route_residual’s Jupiter swap, or inside a token transfer, names Jupiter or the token program on that first line, and belongs to that program’s own error list. Read a code with this table only when the first failing program is privium_pool.
A transaction that fails at the simulation stage carries its logs in the simulation result. One that landed and failed carries them in getTransaction’s meta.logMessages.
Anchor’s own codes#
Codes below 6000 come from Anchor’s account checks, before the handler runs. The ones a privium_pool call meets:
| Code | Name | Meets it when |
|---|---|---|
| 102 | InstructionDidNotDeserialize |
the arguments do not decode as the IDL’s types |
| 2001 | ConstraintHasOne |
admin is not PoolConfig.admin in an instruction only the admin signs (create_shard and admit_asset raise Unauthorized instead); log_diff’s relayer is not the Crossing’s; an EnclaveKey’s platform is not the one passed |
| 2006 | ConstraintSeeds |
a PDA account is not at its seeds’ address |
| 2007 | ConstraintExecutable |
jupiter is not an executable account |
| 2012 | ConstraintAddress |
a sysvar or Jupiter’s program is not at its fixed address |
| 2013 | ConstraintZero |
a deposit queue passed to admit_asset is initialized already, or passed twice |
| 3002 | AccountDiscriminatorMismatch |
an account holds another account type |
| 3007 | AccountOwnedByWrongProgram |
an account the program reads is owned by another program, or a zero-copy account does not exist yet: EscapeState before trigger_escape, for one |
| 3010 | AccountNotSigner |
a required signer did not sign |
| 3012 | AccountNotInitialized |
a mint, token account or Borsh account does not exist yet: an EscapeRequest before escape_request, for one |
An account the instruction creates that exists already fails in the System program, which logs that the address is in use and fails with its own custom code 0. This is how a second release_exit of one Exit, a second escape_claim, a second trigger_escape or a repeated initialization ends.
Through the API and the SDK#
The API reports a refused transaction with the code CHAIN_REFUSED or SIMULATION_FAILED and a programError that names the failing program by address, the error’s name and its number (API errors). The SDK surfaces the same envelope as an ApiClientError (SDK errors).