Custom program error

0x00

Appears in logs as custom program error: 0x0. Defined by 3 programs: SPL Token, System, ATA. Check which program failed in your logs.

Which one is yours?
The log line Program <id> failed: custom program error: 0x0 names the program that returned the code. Match that id to the program below. Anchor programs also print Error Code: … Error Number: … right above the failure.
SPL TokenTokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA

NotRentExempt

“Lamport balance below rent-exempt threshold”

A token account or mint being initialised does not hold enough lamports to be rent exempt. The Token program requires every account it owns to be rent exempt.

Common causes

  • Creating the account with too few lamports before calling InitializeAccount or InitializeMint.
  • Hard-coding an old rent value instead of asking the cluster.
  • For Token-2022, sizing the account for a plain token account but initialising extensions that need more space.

How to fix it

  • Fund the account with getMinimumBalanceForRentExemption(space) lamports. A classic token account is 165 bytes (2,039,280 lamports); a mint is 82 bytes.
  • Use the rent calculator on this site to size Token-2022 accounts with extensions.
System11111111111111111111111111111111

AccountAlreadyInUse

“an account with the same address already exists”

You tried to create an account at an address that already holds an account. The System Program will not overwrite existing accounts.

Common causes

  • Calling create_account or createAccountWithSeed for an address that was already initialised, often by a previous (retried) transaction that actually succeeded.
  • Deriving the same PDA twice in a test or script and running init on it twice.
  • Two transactions racing to initialise the same account; the second one fails with this error.

How to fix it

  • Check whether the account exists before creating it (getAccountInfo). If it does, skip the create step or use init_if_needed in Anchor.
  • If a retried transaction caused this, confirm the first attempt on-chain before resending.
  • Use a fresh keypair or different seeds if you really need a new account.
ATAATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL

InvalidOwner

“Associated token account owner does not match address derivation”

The address you passed as the associated token account was not derived from the given wallet, mint and token program.

Common causes

  • Deriving the ATA with the wrong token program (SPL Token vs Token-2022) for the mint.
  • Passing the wallet and mint in the wrong order to getAssociatedTokenAddress.
  • Using an off-curve wallet (a PDA) without allowOwnerOffCurve: true.

How to fix it

  • Derive with getAssociatedTokenAddressSync(mint, owner, allowOwnerOffCurve, tokenProgramId) using the token program that owns the mint.
  • Use the PDA tool on this site with the ATA preset to confirm the expected address.

Decode another error

Try: