Here's a part of the code of minting my Token-2022 which I've deployed previously


`\npayer: ${payer} $$ ${payer.publicKey}`,
`\nmint: ${mint}`,
`\nsourceTokenAccount: ${sourceTokenAccount}`,
`\nmintAuthority: ${mintAuthority} $$ ${mintAuthority.publicKey}`,

transactionSignature = await mintTo(
  payer, // Transaction fee payer
  mint, // Mint Account address
  sourceTokenAccount, // Mint to
  mintAuthority, // Mint Authority address
  1_000_000_000, // Amount
  [], // Additional signers
  undefined, // Confirmation options
  TOKEN_2022_PROGRAM_ID, // Token Extension Program ID


  "\nMint Tokens:",


payer: [object Object] $$ 6RzpGSb4cMRN6h46DVZ5czWRQsuPGCZdmhHdhUkAYQwU 
mint: EM1Y7YUqvH3Rjsi49wtxsi2R8vmzqaKbWY9PWK8JVBGY 
sourceTokenAccount: DvbiZQjwtBuEwAG2WAXaf6XoCYUN9zn7Ad7iRhfHVbGU 
mintAuthority: [object Object] $$ 4B8dYh439ziBUUWANjGLtAfYeZcwQ7RDEUkNY3qmHZPU

4101 |   }
4102 | }
4103 | 
4104 | class SendTransactionError extends Error {
4105 |   constructor(message, logs) {
4106 |     super(message);
error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: invalid account data for instruction
      at new SendTransactionError (..../p1/node_modules/@solana/web3.js/lib/index.cjs.js:4106:5)
      at ..../p1/node_modules/@solana/web3.js/lib/index.cjs.js:8031:13

Payer has some SOL https://solscan.io/account/4B8dYh439ziBUUWANjGLtAfYeZcwQ7RDEUkNY3qmHZPU?cluster=devnet

as sourceTokenAccount and mintAuthority do too. And you can check them out on solscan too.

Why the error? What's wrong with the arguments?


  const owner = Keypair.generate();

  sourceTokenAccount = await createAccount(
    payer, // Payer to create Token Account
    mint, // Mint Account address
    owner.publicKey, // Token Account owner
    undefined, // Optional keypair, default to Associated Token Account
    undefined, // Confirmation options
    TOKEN_2022_PROGRAM_ID, // Token Extension Program ID

At https://spl.solana.com/token-2022/extensions#setup there's no clue that it has to be a token account.

1 Answer 1


It appears to me that the sourceTokenAccount you are using here is not actually a token account, rather, it seems like a normal user account owned by system program.

When you are transferring tokens, you don't transfer tokens to a user's normal account, instead, the tokens are stored in a separate token account which belongs to that user's wallet address. In this case, you would need to create the source token account first.

After digging through transactions a bit, I can see that you did run the CreateAssociatedToken instruction, which created A97rNqFV6PMyMwuKrJw1ysakYHRVHL49kMyQRf7TZN6b as your token account, try putting this in your sourceTokenAccount variable, that should work.

  • it's not a token account even though its name suggests. Does it have to be one? I've updated my question
    – barugaggi
    Commented Mar 10 at 15:02
  • Yes it must be a token account. Notice in the documentation the sourceAccount is coming from createAccount function, which creates and returns a token account for us. You can see its source: github.com/solana-labs/solana-program-library/blob/… Commented Mar 10 at 17:26
  • But I've created sourceTokenAccount the same way - by createAccount(...)
    – barugaggi
    Commented Mar 10 at 17:28
  • ....which creates and returns a token account for us. -- what is it that makes the function createAccount(...) create a token account rather than a normal one?
    – barugaggi
    Commented Mar 10 at 17:29
  • I provided the source code link for you for that exact reason because I knew you might have similar doubt haha! But main point of difference createAssociatedTokenAccount instruction is used underneath. Solana has native programs that allow specific native actions. System program is the native program which creates normal accounts, but SPL token program has an instruction that can create token account, which the createAccount function calls in client side. Commented Mar 10 at 17:46

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.