Token account not initialized
The SPL Token program expected an initialized token account but received one that has not been set up yet.
Common causes
- Associated Token Account not created. The user’s Associated Token Account (ATA) for a specific mint does not exist yet.
- Account created but not initialized. The account was allocated with
createAccountbut the Token program’sinitializeAccountinstruction was never called. - Wrong account address. The address you passed is a regular wallet or a different type of account, not a token account.
How to fix
- Create the ATA. Use
createAssociatedTokenAccountIdempotentto create the token account if it does not exist:
import { getOrCreateAssociatedTokenAccount } from "@solana/spl-token";
const ata = await getOrCreateAssociatedTokenAccount(
connection,
payer,
mint,
owner
);
- Use
createAssociatedTokenAccountIdempotent. This instruction creates the ATA if needed and does nothing if it already exists, preventing errors from duplicate creation. - Check account existence. Use getAccountInfo to verify the token account exists before calling transfer or other operations.
What is custom program error: 0x3?
Hex 0x3 is decimal 3, which maps to UninitializedAccount in the SPL Token program’s error enum. This is the same error presented differently in transaction logs.
FAQ
What is an Associated Token Account?
An ATA is a deterministic token account derived from the owner’s wallet address and the token mint. Each wallet has exactly one ATA per token mint. The address is computed using getAssociatedTokenAddressSync(mint, owner).
Who pays to create the ATA?
The payer specified in the createAssociatedTokenAccount instruction pays the rent-exempt minimum (~0.002 SOL for a 165-byte token account).
Can I use a non-ATA token account? Yes. You can create arbitrary token accounts, but ATAs are the standard and most wallets and programs expect them.
Error text variants
-
Token account not initialized -
UninitializedAccount -
Account not initialized -
custom program error: 0x3
Sources
Updated: