I created a new token with metadata with this guide. Now I want to create the corresponding token account by using

        const tokenAccount = await getOrCreateAssociatedTokenAccount(

However, I get a TokenAccountNotFoundError. I tried chatgpt, I tried using other methods to create a token account but I always got a different error. (Also tried saving the token address and then trying to create the token account a few minutes later)

TokenAccountNotFoundError at unpackAccount (C:\Users\PycharmProjects\metadata\node_modules@solana\spl-token\src\state\account.ts:170:22) at C:\Users\PycharmProjects\metadata\node_modules@solana\spl-token\src\state\account.ts:103:12 at Generator.next () at fulfilled (C:\Users\PycharmProjects\metadata\node_modules@solana\spl-token\lib\cjs\state\account.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:95:5)

1 Answer 1


Looks like you are missing the token program id. The guide is showing how to interact with the token extensions program. So if you want to find the associated token account you also need to pass in that program id.

Like so:

programId: TOKEN_2022_PROGRAM_ID
  • 1
    Such a simple fix and it worked, thanks a lot!
    – levmilarl
    Commented May 2 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.