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.
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.
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.
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.
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.
| Code | What It Means | Quick Fix |
|---|---|---|
| -32700 | Parse error | JSON's busted. Check your request body. |
| -32600 | Invalid request | Wrong format. Validate params. |
| -32601 | Method not found | Typos in method name? Double check docs. |
| -32602 | Invalid params | Args wrong type or missing. Log and eyeball. |
| -32603 | Internal error | Node'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 }
} 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.
connection.getFeeForMessage(msg).msg.addComputeBudget(1000000). Costs extra ~0.0001 SOL.minimumBalanceForRentExemption.Most guides ignore these, but they're killers for newbies. anchor build bombs? Here's the real stuff.
Run rustc --version. Solana wants specific, like 1.75+. Mismatch?
which -a rustc → multiple? Fix PATH.rustup toolchain list → install Solana's: rustup install 1.75.0.solana --version → match cargo build sbf.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.cargo update -p solana zk token sdk --precise 1.14.19.anchor build. Tests too.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)".
| Code | Title | Fix |
|---|---|---|
| 4900 | Disconnected | Reconnect wallet. |
| 4100 | Unauthorized | User didn't approve connect. |
| 4001 | User Rejected | They said no to sign. |
| -32003 | Tx Rejected | Invalid tx from your code. |
| -32601 | Method Not Found | Wrong provider method. |
JS catch block: if (err.code === 4001) { alert('User bailed'); }. Pretty much handles most UX fails.
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.
Okay, fixes are cool, but I usually avoid 'em.
connection.simulateTransaction before send.console.log(new TransactionSerializer().serialize(tx).toString('base64')).anchor init --no git fresh.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.
(