Anchor
AccountNotInitialized
“The program expected this account to be already initialized”
The account does not exist or has no data, but the program expects it to be initialised. Shows as AccountNotInitialized and is very common when an ATA or PDA was never created.
Common causes
- The associated token account for the user and mint has not been created.
- The PDA account was never initialised (no
initinstruction ran). - Wrong cluster: the account exists on devnet but you are on mainnet.
How to fix it
- Create the account first (for ATAs, use
createAssociatedTokenAccountIdempotent). - Check
getAccountInfoon the address against the cluster you are using.