0

I'm new to Solana development and have encountered an issue while trying to create an SPL token account on the devnet using the SPL Token CLI.

After creating a new SPL token, I attempted to create a token account with the following command: spl-token create-account <Token_Mint_Address>

However, I received the following error message: Error processing Instruction 0: incorrect program id for instruction

I've confirmed that my balance is sufficient and that I'm using the latest version of the SPL Token CLI (3.4.0). Running the command with the --verbose flag did not provide additional insight.

Could there be an issue with the default token program ID, or is there a step I might be missing?

1 Answer 1

0

I faced the same error and while I was searching for a solution, I found your question. It was the exact same problem I had. Thankfully, I found the solution.

I was following a tutorial here

When I started getting the error:

spl-token create-account <token_address> Creating account <token_account_address> Error: Client(Error { request: Some(SendTransaction), kind: RpcError(RpcResponseError { code: -32002, message: "Transaction simulation failed: Error processing Instruction 0: incorrect program id for instruction", data: SendTransactionPreflightFailure(RpcSimulateTransactionResult { err: Some(InstructionError(0, IncorrectProgramId)), logs: Some(["Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke 1", "Program log: Create", "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", "Program log: Instruction: GetAccountDataSize", "Program log: Error: IncorrectProgramId", "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 884 of 194603 compute units", "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: incorrect program id for instruction", "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 6281 of 200000 compute units", "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL failed: incorrect program id for instruction"]), accounts: None, units_consumed: Some(6281), return_data: None }) }) })

I used the spl-token create-token command to create the token locally. Then I used spl-token create-account <token_address> --url https://api.devnet.solana.com to try to create an account for the token on the devnet when I got the error above.

I later realised that I created a token on my local node and tried to create an account for it on the devnet which is why the error says: Transaction simulation failed: Error processing Instruction 0: incorrect program id for instruction

So the fix was to create the token again but this time on the devnet using: spl-token create-token --url https://api.devnet.solana.com and then create an account for the token with the token address on devnet using: spl-token create-account <token_address> --url https://api.devnet.solana.com

The cause of the error are two things:

  1. The inconsistency in the creation of the token and the account i.e if you create the token locally and try to create account on devnet, you'll get the error
  2. If you are creating token on the devnet and your solana cli config is not set accordingly to read from the devnet, then you'll get this error.

So to avoid this error, choose according to your project use case where you want the token and it's account to be ( local or devnet) then configure your solana cli config accordingly.

Solana CLI config quick commands:

  1. Check config current settings: solana config get
  2. Set default RPC cluster to Solana devnet: solana config set -ud
  3. Set default RPC cluster to localhost : solana config set --url localhost --keypair <PATH_TO_WALLET> e.g /home/solana/my_wallet.json

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.