Tx Doctor / Solana error library / Wrong accounts number
Solana error: Wrong accounts number (0x18)
The instruction arrived with the wrong number of accounts. Raydium AMM v4 expects a fixed, ordered account list and validates its length before reading anything.
Why it happens
- A custom client copied the account list from an older program version that had a different count.
- Optional accounts (target orders, market-related) were omitted, shifting every later account by one position.
- An SDK version mismatch: the client is newer than the on-chain program, or the reverse.
- Someone hand-built the transaction and forgot the OpenBook market accounts.
How to fix it
- Use the official SDK to build the instruction — it encodes the exact account order for the deployed program version.
- If you build manually, compare your list against a transaction that succeeded on the same instruction and diff the keys in order.
- Never omit optional accounts by truncating the list; pass the expected placeholders instead.
- Pin the SDK and the program version together; upgrading one without the other is the usual source of this error.
What it looks like in the logs
Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 failed: custom program error: 0x18 RPC simulation: Transaction simulation failed: Error processing Instruction: custom program error: 0x18 Wallet UI: "Transaction failed" — custom program error 0x18 (24)
One failure, three places it shows up: the raw transaction log, the RPC simulation error, and the wallet's short message. Match on the code, never on the wording.
What this means for your funds
Solana transactions are atomic: if any instruction fails, every state change in that transaction is reverted, so token balances end exactly where they started. The network fee is still charged, because validators did the work of executing and rejecting it. A failed transaction never moves your tokens to someone else.
Seeing this error right now? Paste your transaction signature and get the exact instruction, program and code that failed.
Diagnose my transaction