Docs/Reference
Errors
Every failure code, its HTTP status, the stage it belongs to, what raises it and what to do next.
A failure has three fields, wherever it comes from:
codestringrequiredOne of the codes below. Later versions can add codes, so show an unfamiliar one as it is.
stagestringrequiredThe step that failed:
validation,auth,wallet,build,proof,simulation,co_sign,send,confirmation,read,scanoraudit.messagestringrequiredA sentence for the person at the screen.
The API answers a failed request with the failure in an envelope and the code's HTTP status:
{ "error": { "code": "NOT_FOUND", "message": "This payment has not been indexed.", "retryable": false, "stage": "read" } }The envelope adds retryable, which says whether the same request can succeed later, and for a VALIDATION_ERROR a fieldErrors object with the complaints per field.
The SDK throws the same three fields as a LioraFailure, which extends Error. The transfer calls deposit, pay and withdraw do not throw for a failed transfer: they resolve to a state failed that carries the failure in error.
A request that follows a transaction answers HTTP 200 when the transaction itself failed. The failure is then in the error field of the status.
#Codes
Contract 0.2.1.
| Code | Raised when | What to do |
|---|---|---|
VALIDATION_ERRORHTTP 400, validation, build | A body, query, signature encoding, handle, point, address or amount is malformed, or the device cannot encode the transaction. | Correct the input. The message names the field. |
UNSUPPORTED_MEDIA_TYPEHTTP 415, validation | A POST body arrives without the JSON media type. | Send Content-Type: application/json. |
PAYLOAD_TOO_LARGEHTTP 413, validation | The request is over 16,384 bytes, or the decoded transaction is over 4,096 bytes. | Send one transaction per request. |
ORIGIN_NOT_ALLOWEDHTTP 403, validation | A browser request comes from an origin the API is not configured for. | Call from the app's own origin, or from a server. |
NOT_FOUNDHTTP 404, read | The route, the registration, the indexed payment or the relay submission does not exist. | Check the signature or id. A payment appears on the ledger once it is indexed. |
RATE_LIMITEDHTTP 429, read | The service has reached a request limit. | Wait and repeat the request. |
INTERNAL_ERRORHTTP 500, read, build | An unexpected service or device error interrupted the operation. | Repeat the operation. Nothing was sent unless a signature was returned. |
SIGNATURE_INVALIDHTTP 401, auth, wallet | The Ed25519 signature does not verify for the wallet and the exact message. | Sign the message the helper returns, byte for byte, with the wallet named in the request. |
ISSUER_REQUIREDHTTP 403, auth | The action needs the configured issuer's signature or sign-in. | Sign in with the issuer wallet in the program's configuration. |
CONFLICTHTTP 409, validation | A handle, spend key or transaction nonce is already in use, the issuer decided on an old revision, or the entry cannot take that action in its current status. | Read the directory again and decide on the current revision. |
ROOT_EXPIREDHTTP 409, build, proof | The directory the device read no longer reproduces the program's current whitelist root. | Read the directory again and make the payment anew. |
PROGRAM_NOT_ALLOWEDHTTP 422, validation | The transaction does not call the configured Liora program exactly once. | Relay only transactions built by the SDK. |
SIMULATION_FAILEDHTTP 422, simulation | The relayer's simulation of the transaction failed. | Nothing was sent. Scan again and make the transfer anew. |
SIGNING_FAILEDHTTP 502, co_sign | The relayer could not sign as fee payer. | Repeat the request. Nothing was sent. |
SEND_FAILEDHTTP 502, send | The relayer could not submit the transaction. | Follow the signature before repeating: the transaction may have landed. |
CONFIRMATION_FAILEDHTTP 422, confirmation | A submitted transaction failed before it confirmed. | The inputs are unspent. Make the transfer again. |
INPUT_SPENTHTTP 409, validation, simulation | A note in the transfer was already spent, or another transfer that spends it is still pending at the relayer. | Scan again and build the transfer from the notes that remain. |
DEVICE_LOCKEDHTTP 401, wallet, audit | The call needs the holder's keys or the audit key, and the device does not hold them. | Unlock first. |
WALLET_REJECTEDHTTP 400, wallet | The wallet declined to sign. | Ask again when the holder is ready. |
OPERATION_BUSYHTTP 409, build | Another holder operation is still running on this SDK instance. | Wait for it to finish. |
INSUFFICIENT_BALANCEHTTP 409, build | The spendable notes do not cover the amount plus the two flat fees. | Deposit, or send less. |
NOT_WHITELISTEDHTTP 409, proof | The recipient has no active leaf in the directory snapshot. | The recipient registers and the issuer admits them. |
PROOF_FAILEDHTTP 422, proof | The directory did not reproduce the selected root, or proving failed. | Read the directory again and repeat the payment. |
INVALID_AUDIT_KEYHTTP 401, audit | The audit secret does not match the auditor public key in the configuration. | Load the key that belongs to this deployment. |
INVALID_RESPONSEHTTP 502, read, confirmation | A reply could not be read, or a submitted transaction has a status the device does not know. | Follow the signature to learn what happened. |
API_UNAVAILABLEHTTP 503, read | The device could not reach the API. | Check the connection and repeat. A transfer that already has a signature is followed, never sent twice. |
NOTE_INVALIDHTTP 422, scan, audit | A note that matched the holder's keys failed to open, or an audited identity is not in the directory. | Scan again from a fresh directory. |
UNLOCK_FAILEDHTTP 401, wallet | Key derivation failed after the wallet signed. | Unlock again with a wallet that signs messages with Ed25519. |
The SDK raises two more codes of its own, in real mode:
| Code | Stage | Raised when | What to do |
|---|---|---|---|
CONFIGURATION_REQUIRED | proof | The program has no configuration yet, or deviceProverUrl points at the API instead of a prover of its own. | Correct the SDK's options. |
INDEXER_PENDING | read, scan | At read: an issuer's transaction confirmed and the directory has not shown it yet. At scan: the Rings indexer has not reached the latest confirmed slot, so balances are withheld. | Wait and read again. Nothing needs to be sent a second time. |
#Program errors
The Liora program's own errors, as they appear in a failed transaction or a simulation. Program 0.2.1.
| Code | Name and message | Raised by | Raised when |
|---|---|---|---|
| 6000 | WrongAuthorityThe selected authority does not control this configuration. | initialize, configure | The initializing wallet is not the program's upgrade authority, or the admin, issuer, relayer or fee recipient is the zero address. |
| 6001 | InvalidFieldA Poseidon input is outside the BN254 field. | initialize, configure, admit, pay, withdraw, hash_vector | A value passed to Poseidon is not below the BN254 field modulus, or hash_vector got no values or more than 12. |
| 6002 | InvalidPointThe packed public point does not match the supplied coordinates. | admit | spend_point is not the packed form of the coordinates in affine. |
| 6003 | InvalidTreePathThe whitelist path does not open the current root. | admit, remove | The siblings do not lead from the leaf to the current root, the leaf hashes to zero, or the tree is full. |
| 6004 | RevisionChangedThe issuer signed an outdated revision. | admit, remove | revision is not the configuration's current revision: the whitelist changed after the issuer read it. |
| 6005 | InactiveEntryThe entry has already been removed. | remove | The entry was already removed. |
| 6006 | RootExpiredThe payment root has expired. | pay | The announcement's whitelist_root is not among the accepted roots. |
| 6007 | InvalidSppThe SPP instruction or account layout is invalid. | deposit, pay, withdraw | The forwarded SPP instruction is of the wrong kind or shape, or the accounts passed with it are not the ones it needs, in order. |
| 6008 | InvalidOwnerThe output owner is not allowed for this operation. | deposit, pay, withdraw | An output goes to an owner the operation does not allow, an owner is listed twice or does not match its account, or a payment does not have exactly one output at the stealth address. |
| 6009 | InvalidSettlementThe public withdrawal or its fee split is invalid. | initialize, configure, pay, withdraw | The Ring does not pay out exactly the amount plus both fees to the settlement address, the relayer ends the instruction short of the signature fee it paid, a payment's destination is not the relayer, a withdrawal amount is zero, both fees are zero, or the fee recipient is the settlement address. |
| 6010 | InvalidProofThe Liora proof failed verification. | pay, withdraw | The proof does not decompress or does not verify against the statement the program computed. |
| 6011 | ArithmeticThe amount is outside the supported range. | initialize, configure, admit, remove, pay, withdraw | A sum of lamports or a counter leaves its range. |
The relayer reports a simulation that failed with one of these as SIMULATION_FAILED, with a fixed message. The device raises ROOT_EXPIRED itself, when the directory it read no longer reproduces the program's current root.
#By stage
| Stage | The transfer stopped | Was anything sent |
|---|---|---|
validation, auth, wallet, build, proof | Before the transaction existed | No |
simulation, co_sign | At the relayer, before sending | No |
send | While submitting | Possibly: follow the signature |
confirmation | On chain | Sent and failed; the inputs are unspent |
read, scan, audit | While reading | Nothing to send |