Solana Error Codes: Full List and Fixes Explained.

Okay, look. Every other "Solana error guide" out there? They dump a massive list of codes with zero context. Like, here's 6000, it means something bad happened, good luck. But that's useless. You hit an error at 2am debugging your dApp, and you're not googling enums. You need why it happens and copy paste fixes. That's what we're doing here. In my experience, 90% of Solana pains come from like 10 errors anyway. Let's fix 'em for real.

Transaction Errors: The Ones That Kill Your Trades

Transactions failing? Sound familiar? That's Solana's bread and butter headache. You send a swap or mint, it bombs. First thing: grab the tx signature from your logs. Paste it into Solana Explorer. Boom, error code right there.

Now, those codes. Programs throw 'em as numbers. Like 20? Means "Missing update authority" in Metaplex Core. How? Explorer shows the instruction index that failed. Say it's the 3rd one (index 2). Check the program's error.rs on GitHub. Count down from 0. Index 2 = error 20. Easy.

6xxx Errors: Anchor's Custom Nightmares

These start at 6000. Custom per program. Candy Machine gives 6006? Last two digits = 06. Scroll errors.rs, 6th one down: "Candy machine is empty." Duh. Fix? Check if it's got items left. Reload your frontend state.

  1. Copy tx sig.
  2. Explorer → error code + index.
  3. GitHub program/errors.rs → match the number.
  4. Read the msg. Fix the logic.

Why does this matter? Spent hours once on 6026 thinking network issue. Nope, just bad state. Annoying but quick once you know.

Pro tip: In JS, use npx @solana/errors decode -- 123 for Solana JS errors. Strips messages in prod to save bytes, but this gets 'em back.

RPC Hell: When the Node Hates You

Building RPC calls? Get slammed with -32602 or 7429? That's not your code. That's the RPC node flipping out. Standard JSON RPC ones first.

CodeWhat It MeansQuick Fix
-32700Parse errorJSON's busted. Check your request body.
-32600Invalid requestWrong format. Validate params.
-32601Method not foundTypos in method name? Double check docs.
-32602Invalid paramsArgs wrong type or missing. Log and eyeball.
-32603Internal errorNode's drunk. Retry or switch RPC.

Solana specials in -32xxx. -32004? Block pruned, use recent ones. -32005? Node's unhealthy, wait 30s.

Provider ones vary. Syndica's 7429 = rate limited. Chill or upgrade. 7700? Bad headers. QuickNode 429? RPS too high, throttle your loop.

I usually wrap RPC calls like this:

try { const res = await connection.getBalance(pubkey);
} catch (err) { if (err.code === -32602) { console.log('Params suck, fix args'); } else if (err.code === 7429) { await sleep(1000); // backoff }
}

Program Errors: The Deep Cuts

  • InvalidArgument: Wrong input to instruction. Check account writable? Signer?
  • InvalidInstructionData: Deserialization failed. Data too short or garbage.
  • InvalidAccountData: Account contents wrong. Deser bombs or state mismatch.
  • AccountDataTooSmall: Not enough bytes. Resize or check init.
  • InsufficientFunds: Duh. Top up the fee payer. ~0.000005 SOL usually.
  • IncorrectProgramId: Called wrong program. CPI target mismatch.
  • MissingRequiredSignature: Not all signers signed.
  • AccountAlreadyInitialized: Tried init twice. Check discriminator.
  • IllegalOwner: Account owner wrong program.

These come from Solana's program error crate. Token program loves InvalidInstructionData for bad instr discriminators. In my programs, I throw InvalidAccountData if len < expected.

Fixing InsufficientFunds Step by Step

  1. Check fee estimator: connection.getFeeForMessage(msg).
  2. Add priority fee: msg.addComputeBudget(1000000). Costs extra ~0.0001 SOL.
  3. Balance low? Airdrop devnet or send real SOL.
  4. Still? Rent exempt? Calc with minimumBalanceForRentExemption.

Dev Build Errors: Rust and Anchor Nightmares

Most guides ignore these, but they're killers for newbies. anchor build bombs? Here's the real stuff.

Rust Version Conflicts

Run rustc --version. Solana wants specific, like 1.75+. Mismatch?

  1. which -a rustc → multiple? Fix PATH.
  2. rustup toolchain list → install Solana's: rustup install 1.75.0.
  3. solana --version → match cargo build sbf.
  4. rustup override set 1.75.0 in project dir.

In my experience, Homebrew Rust fights rustup. Nuke brew one.

Borsh serialization? Cargo.toml versions clash.

  • anchor clean && cargo update.
  • Pin: cargo update -p solana zk token sdk --precise 1.14.19.
  • anchor build. Tests too.

Module Parse Failed (JS Side)

React Native + @solana/web3.js? BigInt literals break old Babel.

Fix: babel.config.js → presets: [['@babel/preset env', {targets: {esmodules: true}}]]. Or target ES2020+.

Unstable Rust feature like build_hasher? Update Solana CLI: sh -c "$(curl -sSfL https://release.solana.com/stable/install)".

Wallet and Client Errors: Phantom, Etc.

CodeTitleFix
4900DisconnectedReconnect wallet.
4100UnauthorizedUser didn't approve connect.
4001User RejectedThey said no to sign.
-32003Tx RejectedInvalid tx from your code.
-32601Method Not FoundWrong provider method.

JS catch block: if (err.code === 4001) { alert('User bailed'); }. Pretty much handles most UX fails.

Blockstore and Other Weirdos

Running validator? Blockstore errors mean ledger corrupt. solana validator --ledger /path clean. But backups first.

HTTP 429 everywhere? Throttle. Sleep 200ms between calls. Or get better RPC like Helius/QuickNode.

Prevention: Don't Let 'Em Happen

Okay, fixes are cool, but I usually avoid 'em.

  • Always sim tx: connection.simulateTransaction before send.
  • Logs: console.log(new TransactionSerializer().serialize(tx).toString('base64')).
  • Versions: Pin Cargo.toml, anchor init --no git fresh.
  • Testnet first. Devnet SOL free.
  • Priority fees during congestion. 0.00001 SOL extra usually lands it.

What's next? Hit a weird one? Explorer + GitHub errors.rs. 99% solved. The thing is, Solana's fast but picky. Get these down, you're golden.

One more: Duplicate subscription on WS? 7702. New connection. Subs maxed? 7703, close old ones.

Honestly, after a dozen tx fails, you'll spot patterns. InvalidAccountData? State drift. InsufficientFunds? Fee spike. Keep logs. You'll be the error whisperer.

(