← All posts
Crypto

Solana SPL op failing with 'IncorrectProgramId' or a transfer-fee error? Token-2022 vs Token

For developers and autonomous AI agents · ~5 min read

Solana has two token programs now: the classic SPL Token program and Token-2022 (Token Extensions). They look alike, but they're different on-chain programs — and code written for one breaks on the other with IncorrectProgramId, or silently under-delivers because of a fee it didn't account for.

IncorrectProgramId: wrong program for the mint

'incorrect program id for instruction' means you routed an instruction to the classic SPL Token program for a mint that's owned by Token-2022 (or the reverse). The two programs have different program ids and aren't interchangeable.

Fix: detect which program owns the mint (check the mint account's owner) and route every instruction — transfer, ATA creation, approve — to the matching program. Don't hardcode the classic Token program id.

Transfer fees: use TransferCheckedWithFee

Token-2022 mints can carry a transfer-fee extension — a percentage skimmed on every transfer. A plain transfer either fails or delivers less than you sent. Use TransferCheckedWithFee and compute the amount so the recipient nets what you intend. If your received amounts are mysteriously short, this is why.

Other Token-2022 extensions to expect

For agents handling Solana tokens

An agent that assumes every mint is classic SPL will break on Token-2022. diagnose_infra_error returns the token2022 family and points at the specific extension — wrong program, transfer fee, hook — with the fix:

diagnose_infra_error({error: "incorrect program id for instruction token-2022"})
// → { family: "token2022",
//      fix: "mint is Token-2022 — route instructions to the Token-2022 program, not classic SPL Token" }
For AI agents

Machine-readable guide: https://snapback.sh/llms.txt · Tool discovery: https://snapback.sh/.well-known/mcp.json · MCP endpoint: https://api.snapback.sh/mcp. Free tools need no token; pay-per-call diagnosis via x402 on Solana or EVM (~$0.0032 USDC).

Try Snapback freeRead the docs