DocsErrors

DocsReference30 of 33 · 2 min read

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:

codestringrequired

One of the codes below. Later versions can add codes, so show an unfamiliar one as it is.

stagestringrequired

The step that failed: validation, auth, wallet, build, proof, simulation, co_sign, send, confirmation, read, scan or audit.

messagestringrequired

A 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:

json
{ "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.

CodeRaised whenWhat to do
VALIDATION_ERROR
HTTP 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_TYPE
HTTP 415, validation
A POST body arrives without the JSON media type.Send Content-Type: application/json.
PAYLOAD_TOO_LARGE
HTTP 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_ALLOWED
HTTP 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_FOUND
HTTP 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_LIMITED
HTTP 429, read
The service has reached a request limit.Wait and repeat the request.
INTERNAL_ERROR
HTTP 500, read, build
An unexpected service or device error interrupted the operation.Repeat the operation. Nothing was sent unless a signature was returned.
SIGNATURE_INVALID
HTTP 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_REQUIRED
HTTP 403, auth
The action needs the configured issuer's signature or sign-in.Sign in with the issuer wallet in the program's configuration.
CONFLICT
HTTP 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_EXPIRED
HTTP 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_ALLOWED
HTTP 422, validation
The transaction does not call the configured Liora program exactly once.Relay only transactions built by the SDK.
SIMULATION_FAILED
HTTP 422, simulation
The relayer's simulation of the transaction failed.Nothing was sent. Scan again and make the transfer anew.
SIGNING_FAILED
HTTP 502, co_sign
The relayer could not sign as fee payer.Repeat the request. Nothing was sent.
SEND_FAILED
HTTP 502, send
The relayer could not submit the transaction.Follow the signature before repeating: the transaction may have landed.
CONFIRMATION_FAILED
HTTP 422, confirmation
A submitted transaction failed before it confirmed.The inputs are unspent. Make the transfer again.
INPUT_SPENT
HTTP 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_LOCKED
HTTP 401, wallet, audit
The call needs the holder's keys or the audit key, and the device does not hold them.Unlock first.
WALLET_REJECTED
HTTP 400, wallet
The wallet declined to sign.Ask again when the holder is ready.
OPERATION_BUSY
HTTP 409, build
Another holder operation is still running on this SDK instance.Wait for it to finish.
INSUFFICIENT_BALANCE
HTTP 409, build
The spendable notes do not cover the amount plus the two flat fees.Deposit, or send less.
NOT_WHITELISTED
HTTP 409, proof
The recipient has no active leaf in the directory snapshot.The recipient registers and the issuer admits them.
PROOF_FAILED
HTTP 422, proof
The directory did not reproduce the selected root, or proving failed.Read the directory again and repeat the payment.
INVALID_AUDIT_KEY
HTTP 401, audit
The audit secret does not match the auditor public key in the configuration.Load the key that belongs to this deployment.
INVALID_RESPONSE
HTTP 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_UNAVAILABLE
HTTP 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_INVALID
HTTP 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_FAILED
HTTP 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:

CodeStageRaised whenWhat to do
CONFIGURATION_REQUIREDproofThe program has no configuration yet, or deviceProverUrl points at the API instead of a prover of its own.Correct the SDK's options.
INDEXER_PENDINGread, scanAt 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.

CodeName and messageRaised byRaised when
6000WrongAuthority
The selected authority does not control this configuration.
initialize, configureThe initializing wallet is not the program's upgrade authority, or the admin, issuer, relayer or fee recipient is the zero address.
6001InvalidField
A Poseidon input is outside the BN254 field.
initialize, configure, admit, pay, withdraw, hash_vectorA value passed to Poseidon is not below the BN254 field modulus, or hash_vector got no values or more than 12.
6002InvalidPoint
The packed public point does not match the supplied coordinates.
admitspend_point is not the packed form of the coordinates in affine.
6003InvalidTreePath
The whitelist path does not open the current root.
admit, removeThe siblings do not lead from the leaf to the current root, the leaf hashes to zero, or the tree is full.
6004RevisionChanged
The issuer signed an outdated revision.
admit, removerevision is not the configuration's current revision: the whitelist changed after the issuer read it.
6005InactiveEntry
The entry has already been removed.
removeThe entry was already removed.
6006RootExpired
The payment root has expired.
payThe announcement's whitelist_root is not among the accepted roots.
6007InvalidSpp
The SPP instruction or account layout is invalid.
deposit, pay, withdrawThe forwarded SPP instruction is of the wrong kind or shape, or the accounts passed with it are not the ones it needs, in order.
6008InvalidOwner
The output owner is not allowed for this operation.
deposit, pay, withdrawAn 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.
6009InvalidSettlement
The public withdrawal or its fee split is invalid.
initialize, configure, pay, withdrawThe 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.
6010InvalidProof
The Liora proof failed verification.
pay, withdrawThe proof does not decompress or does not verify against the statement the program computed.
6011Arithmetic
The amount is outside the supported range.
initialize, configure, admit, remove, pay, withdrawA 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

StageThe transfer stoppedWas anything sent
validation, auth, wallet, build, proofBefore the transaction existedNo
simulation, co_signAt the relayer, before sendingNo
sendWhile submittingPossibly: follow the signature
confirmationOn chainSent and failed; the inputs are unspent
read, scan, auditWhile readingNothing to send