Skip to content
Lean Key
Reference

Errors

Every error the program returns, with its number, its name and exactly when it happens, plus the errors the clients raise before anything is sent.

A failed Lean Key instruction fails the whole transaction and changes nothing. There are three sources of errors: Lean Key's own custom errors, standard Solana program errors that the program returns, and errors from the programs it calls (System Program, SPL Token, Token-2022). The clients add a fourth kind: refusals before anything is signed or sent.

Custom program errors

The program's custom errors are numbered from 6001 (6000 is not used). Solana reports them in the transaction error and in the logs like this, for instruction index 1:

{"InstructionError":[1,{"Custom":6005}]}
Program TwoKhewkScEnH75rbs9nC5ScrsFQT93DrHsSSZvpVHn failed: custom program error: 0x1775

Names and messages are those in PROGRAM_ERRORS (packages/core/src/instructions.ts); "When" is what the program checks (program/Twokey/Program.lean).

CodeHexNameMessage (clients)When
60010x1771NotOwnerThe signer is not this vault's owner.Account 0 is not the owner stored in the vault (offset 2). Checked in every instruction except InitVault, before any signature work.
60020x1772NotVaultThat account is not an open Lean Key vault.Account 1 is not owned by this program, or is not 91 bytes, or its version byte is not 1. Also if, after InitVault's allocation, the account is not 91 bytes.
60030x1773AlreadyOpenA vault already exists at this address.InitVault: the address is no longer owned by the System Program, or already holds data. Every vault, open or closed, gives this.
60040x1774BadAddressThe vault address does not match its seeds.InitVault: the vault account's address is not the SHA-256 derivation of "vault", owner, vault_id, bump and the program id. A wrong bump or a keypair address gives this.
60050x1775BadSignatureThe hash signature does not match the vault's current one-time key.The WOTS+ signature does not verify for the intent the program rebuilt, under the vault's stored pk_hash. Any changed field (amount, destination, asset, next key), a signature for an older key index, a signature from another seed or for another vault, and the clients' all-zero placeholder all give this.
60060x1776BelowRentThe vault must keep its rent-exempt minimum.WithdrawSol: the vault holds less than its rent-exempt minimum, or the amount is more than the balance above it. CloseVault: the vault holds less than its minimum.
60070x1777TransferHookMints with a transfer hook are not supported in v1.WithdrawToken: the mint has a Token-2022 TransferHook extension (type 14) whose program id is not all zero.
60080x1778BadTokenAccountA token account is not what the intent needs: wrong token program, too short, a different mint, or not owned by the vault.The vault's token account is not owned by the given token program, is shorter than 165 bytes, holds another mint than account 4 (WithdrawToken), or does not name the vault as its owner. Also WithdrawToken when the destination token account is not owned by the token program.
60090x1779BadMintThe mint is not a mint of this token program, is too short, or has a malformed transfer-hook extension.WithdrawToken: the mint account is not owned by the given token program, is shorter than 82 bytes, or has a TransferHook extension entry shorter than 64 bytes or running past the end of the account. A mint that differs from the token account's mint is 6008, not 6009.
60100x177aZeroAmountThe amount must be greater than zero.WithdrawSol or WithdrawToken with amount 0.
60110x177bZeroNextKeyThe next key hash must not be empty.next_pk_hash (or InitVault's pk_hash_0) is 32 zero bytes.

Standard program errors

lean-svm returns Solana's standard program errors as a value in the high 32 bits of the return register. Solana reports them by name:

{"InstructionError":[1,"MissingRequiredSignature"]}
NameReturned valueWhen Lean Key returns it
InvalidInstructionData0x0000000300000000Empty instruction data; an unknown first byte; a data length that is not exactly 42, 665, 666 or 657 for its instruction.
InvalidAccountData0x0000000400000000An account that must be writable is not (owner in InitVault, vault, destination, token accounts); an account repeats another where that is not allowed (only the destination may repeat the owner).
IncorrectProgramId0x0000000700000000InitVault's account 2 is not the System Program; the token program account is neither SPL Token nor Token-2022.
MissingRequiredSignature0x0000000800000000Account 0 (the owner) did not sign.
NotEnoughAccountKeys0x0000000b00000000The number of accounts is not exactly 3, 3, 6, 5 or 3 for the instruction, more or fewer.
UnsupportedSysvar0x0000001100000000The Rent or Clock sysvar cannot be read, or the rent exemption threshold is neither 2.0 nor 1.0.
ArithmeticOverflow0x0000001800000000A checked 64-bit sum or product would overflow: the destination's new balance, the next key index, or the rent computation.

Errors from called programs

These come from the System Program or the token program during a cross-program invocation, and Solana reports them as that program's errors.

SituationTypical cause
InitVault rent top-up failsThe owner does not have enough lamports to fund the vault's rent-exempt minimum.
WithdrawToken transfer failsThe vault's token account holds fewer tokens than the amount; the destination token account is for another mint; decimals does not match the mint; an account is frozen.
CloseTokenAccount failsThe token account still holds tokens.

The model the proofs are about folds all token-program refusals into one error; see Trust boundaries.

Errors from the clients

The CLI, the extension and the site use packages/core, which refuses many requests before any one-time key is used. None of these sends a transaction.

MessageMeaning
Refused before signing, no one-time key used: …The simulation with the placeholder signature stopped somewhere other than BadSignature (6005), so the real signature would not help. The reason follows (for example NotOwner (6001)).
This vault's owner is X, not Y.The owner you gave is not the vault's owner.
The vault is at key #k, not #j. Refresh and try again.The key index you saw is out of date.
Only N lamports are above the vault's rent-exempt minimum.Amount larger than the withdrawable balance.
The destination is an empty account: send at least N lamports so it is rent-exempt.The runtime would reject a new account left below its rent minimum.
The vault holds none of this token. / The vault holds N base units of this token.No such token account, or not enough.
The vault's token account is frozen by the mint's freeze authority. / The recipient's token account is frozen.The transfer would fail in the token program.
This Token-2022 mint has a transfer hook. Lean Key refuses those.The program would refuse it (6007).
Withdraw the tokens first: only an empty token account can be closed.The token program would refuse the close.
This vault is already closed.CloseVault on a vault whose closed flag is set.
Key #k of this vault already signed a different intent. …The journal rule: this key index already signed another intent that has not landed. Only that one can be sent. See Recovery and safety.
Signed, but the simulation failed: … Retry the same intent once the cause is fixed.The key was used and the intent is in the journal, but the transaction would fail, so it was not sent.
The transaction expired before it landed. Nothing moved; it can be sent again.The blockhash expired. Only the same intent can be sent again.

Reading an error

explainError in packages/core/src/decode.ts turns a transaction error and its logs into one line, for example BadSignature (6005): The hash signature does not match the vault's current one-time key. The CLI prints this after error: and exits with status 1. With --json it prints the same line as JSON:

{"error":"Signed, but the simulation failed: BadSignature (6005): The hash signature does not match the vault's current one-time key. Retry the same intent once the cause is fixed."}

Connect a wallet

Your wallet signs as the owner (Key A). Lean Key adds the post-quantum key (Key B).

Wallets

Any wallet that supports the Solana Wallet Standard appears under Installed. Lean Key never asks for your seed phrase on this site.