Common Solana Web3.js Production Errors - Quick Reference

Error Message

Cause

Fix

Time to Debug

Blockhash not found

Transaction took too long (>60 seconds)

Get fresh blockhash right before sending

5 mins

Account not found

Wrong PDA derivation or typo in address

Double-check seeds and program ID

30 mins

Transaction simulation failed

Account constraints violated

Check account ownership and data

2+ hours

Signature verification failed

Missing signer or wrong keypair

Verify all required signers included

15 mins

Program error: Custom program error: 0x1770

Generic Anchor error

Check program logs for actual error

1+ hours

Error processing Instruction

CPI failed or account data issues

Enable verbose logging

45 mins

Node.js heap out of memory

Memory leak from Connection objects

Reuse connections, dispose subscriptions

3+ hours

RPC endpoint timeout

Network congestion or slow RPC

Switch providers, implement retry logic

20 mins

InstructionError: InvalidAccountData

Account deserialization failed

Check account discriminator (+8 bytes)

1 hour

InstructionError: NotEnoughAccountKeys

Missing accounts in instruction

Verify all required accounts passed

30 mins

Emergency Debugging Questions (When Everything's on Fire)

Q

My app crashed with "heap out of memory" - what the fuck?

A

You're creating new Connection objects without disposing them. Each connection opens WebSocket subscriptions that never get garbage collected. I've seen this kill production apps after exactly 8 hours when the memory limit hits.

Nuclear fix: Restart the service. Real fix: Create one connection, reuse it everywhere:

// BAD - creates new connection every call
function getBalance() {
  const connection = new Connection(RPC_URL);
  return connection.getBalance(pubkey);
}

// GOOD - reuse connection
const globalConnection = new Connection(RPC_URL);
function getBalance() {
  return globalConnection.getBalance(pubkey);
}
Q

Why do my transactions randomly fail with "Blockhash not found"?

A

Because you're too slow. Blockhashes expire in 60-90 seconds, and you're probably fetching it once and reusing it for multiple transactions. Get a fresh blockhash right before sending each transaction.

Pro tip: Check your system clock. I once spent 4 hours debugging this because my server's clock was 3 minutes fast. Solana nodes rejected everything because they thought my transactions were from the future.

Q

My PDA derivation keeps failing - seeds are correct, what gives?

A

Wrong program ID. 99% of the time it's a copy-paste error where you're using the wrong program ID for derivation. Double-check against your deployed program:

solana program show <PROGRAM_ID>

Also check seed order - [b"user", user_pubkey.as_ref()] is different from [user_pubkey.as_ref(), b"user"].

Q

Anchor errors showing "Custom program error: 0x1770" - useless!

A

Enable verbose logging to see the actual error. Add this to your connection:

const connection = new Connection(RPC_URL, {
  commitment: 'confirmed',
  confirmTransactionInitialTimeout: 30000,
  disableRetryOnRateLimit: false
});

Then check the program logs in Solana Explorer with your transaction signature. The real error is usually buried in there.

Q

My mobile app loads slowly - bundle size issues?

A

v1.x is 400KB+ which kills mobile performance. You have two options:

  1. Switch to v2.0 - bundles down to ~100KB but breaks ecosystem compatibility
  2. Lazy load Web3.js - only import when actually needed
// Lazy load approach
const { Connection, PublicKey } = await import('@solana/web3.js');
Q

Priority fees aren't working - transactions still slow

A

You're probably setting them wrong. Use Helius Priority Fee API to get current rates:

const feeEstimate = await fetch('https://mainnet.helius-rpc.com/', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'getPriorityFeeEstimate',
    params: [{ accountKeys: [account.toString()] }]
  })
});

Systematic Debugging Approach (For When Panic Sets In)

Step 1: Identify the Error Category

When your Solana app explodes in production, don't panic-refresh everything. First, categorize what broke:

Network Issues (50% of problems): RPC timeouts, connection failures, rate limiting
Transaction Issues (30% of problems): Blockhash expired, simulation failed, wrong fees
Account Issues (15% of problems): PDA derivation, missing accounts, wrong data
Code Issues (5% of problems): Memory leaks, logic errors, version conflicts

Most developers immediately assume it's a code problem. It's usually network issues.

Step 2: Check the Obvious Shit First

Before diving into complex debugging, check these in order:

  1. Network Status: Is status.solana.com green? If not, it's not your fault.
  2. RPC Health: Try switching to a different RPC provider temporarily. Helius, QuickNode, or Chainstack have better reliability than public endpoints.
  3. Recent Changes: What changed in the last deployment? Revert if possible.
  4. Error Frequency: Is this affecting 100% of transactions or just some users?

Step 3: Enable Comprehensive Logging

The default Solana Web3.js logging is garbage. Here's what actually helps:

// Production logging setup
const connection = new Connection(RPC_URL, {
  commitment: 'confirmed',
  confirmTransactionInitialTimeout: 60000,
  disableRetryOnRateLimit: false,
  // Add custom fetch for logging
  fetch: (url, options) => {
    console.log(`RPC Request: ${options.method || 'GET'} ${url}`);
    console.log(`Request body:`, JSON.parse(options.body || '{}'));
    
    return fetch(url, options).then(response => {
      if (!response.ok) {
        console.error(`RPC Error: ${response.status} ${response.statusText}`);
      }
      return response;
    });
  }
});

Step 4: Transaction Debugging Workflow

For transaction failures, follow this systematic approach:

a) Check Transaction Status

const signature = await connection.sendRawTransaction(transaction.serialize());
const status = await connection.confirmTransaction(signature);
console.log('Transaction status:', status);

b) Inspect Transaction Details

const parsedTx = await connection.getParsedTransaction(signature);
console.log('Parsed transaction:', JSON.stringify(parsedTx, null, 2));

c) Check Account States

// Before transaction
const accountBefore = await connection.getAccountInfo(targetAccount);
console.log('Account before:', accountBefore);

// After failed transaction  
const accountAfter = await connection.getAccountInfo(targetAccount);
console.log('Account after:', accountAfter);

Step 5: Memory Leak Detection

Memory leaks kill Node.js apps slowly, then suddenly. Monitor these metrics:

// Add to your health check endpoint
app.get('/health', (req, res) => {
  const usage = process.memoryUsage();
  const mb = (bytes) => Math.round(bytes / 1024 / 1024);
  
  res.json({
    memory: {
      rss: `${mb(usage.rss)}MB`,
      heapTotal: `${mb(usage.heapTotal)}MB`, 
      heapUsed: `${mb(usage.heapUsed)}MB`,
      external: `${mb(usage.external)}MB`
    },
    uptime: process.uptime()
  });
});

Warning signs: heapUsed growing continuously, never declining after GC.

Step 6: PDA Debugging Deep Dive

PDA issues are subtle and evil. Here's how to debug them systematically:

// Debug PDA derivation
function debugPDA(seeds, programId) {
  console.log('Seeds:', seeds.map(s => 
    Buffer.isBuffer(s) ? s.toString('hex') : s
  ));
  console.log('Program ID:', programId.toString());
  
  try {
    const [pda, bump] = PublicKey.findProgramAddressSync(seeds, programId);
    console.log('Derived PDA:', pda.toString());
    console.log('Bump:', bump);
    return pda;
  } catch (error) {
    console.error('PDA derivation failed:', error);
    throw error;
  }
}

Common PDA failures:

  • Seed encoding issues (string vs Buffer)
  • Wrong program ID (copy-paste from wrong environment)
  • Seed order matters: [a, b][b, a]
  • Missing bump seed validation

Step 7: Performance Profiling in Production

Don't guess where bottlenecks are. Measure:

// Wrap RPC calls with timing
async function timedRPC(operation, ...args) {
  const start = Date.now();
  try {
    const result = await operation(...args);
    const duration = Date.now() - start;
    console.log(`RPC took ${duration}ms`);
    return result;
  } catch (error) {
    const duration = Date.now() - start;
    console.error(`RPC failed after ${duration}ms:`, error.message);
    throw error;
  }
}

// Usage
const balance = await timedRPC(
  connection.getBalance.bind(connection),
  publicKey
);

Step 8: Emergency Production Fixes

When everything's broken and users are screaming:

1. Circuit Breaker Pattern

let failureCount = 0;
const MAX_FAILURES = 5;
const RESET_TIMEOUT = 30000;

async function circuitBreakerRPC(operation) {
  if (failureCount >= MAX_FAILURES) {
    throw new Error('Circuit breaker open - too many failures');
  }
  
  try {
    const result = await operation();
    failureCount = 0; // Reset on success
    return result;
  } catch (error) {
    failureCount++;
    if (failureCount >= MAX_FAILURES) {
      setTimeout(() => failureCount = 0, RESET_TIMEOUT);
    }
    throw error;
  }
}

2. Fallback RPC Providers

const RPC_ENDPOINTS = [
  'https://api.mainnet-beta.solana.com',
  'https://mainnet.helius-rpc.com/',
  'https://solana-mainnet.rpc.quicknode.pro/YOUR_TOKEN'
];

async function fallbackRPC(operation) {
  for (const endpoint of RPC_ENDPOINTS) {
    try {
      const connection = new Connection(endpoint);
      return await operation(connection);
    } catch (error) {
      console.warn(`RPC ${endpoint} failed:`, error.message);
      continue;
    }
  }
  throw new Error('All RPC endpoints failed');
}

3. Transaction Retry with Exponential Backoff

async function retryTransaction(transactionFn, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await transactionFn();
    } catch (error) {
      if (i === maxRetries - 1) throw error;
      
      const delay = Math.pow(2, i) * 1000; // 1s, 2s, 4s
      console.log(`Transaction failed, retrying in ${delay}ms...`);
      await new Promise(resolve => setTimeout(resolve, delay));
    }
  }
}

What NOT to Do (Common Panic Mistakes)

  • Don't restart everything - You'll lose debugging context
  • Don't immediately deploy fixes - Debug first, fix second
  • Don't ignore Solana Explorer - Transaction signatures contain crucial debugging info
  • Don't assume it's your code - Network issues are more common
  • Don't disable error handling - You need those error details

Debugging Tools and Solutions Comparison

Tool/Service

Use Case

Pros

Cons

Cost

Solana Explorer

Transaction inspection

Free, comprehensive, real-time

UI can be slow, limited filtering

Free

SolanaFM

Enhanced transaction details

Better error messages, cleaner UI

Limited historical data

Free

Helius RPC

Reliable RPC + Priority Fee API

Fast, stable, good docs

Costs money after free tier

$0-199/month

QuickNode

Managed RPC infrastructure

Enterprise features, monitoring

More expensive, complex setup

$9-999/month

Helius Enhanced APIs

Account/transaction data

Rich metadata, webhooks, priority fees

Rate limited, paid plans

$0-199/month

Node.js --inspect

Memory leak debugging

Built-in, powerful profiling

Requires Chrome DevTools knowledge

Free

Datadog/New Relic

Production monitoring

Full observability stack

Expensive, complex setup

$15+/month

Essential Debugging Resources and Tools

Related Tools & Recommendations

tool
Similar content

Debug Kubernetes Issues: The 3AM Production Survival Guide

When your pods are crashing, services aren't accessible, and your pager won't stop buzzing - here's how to actually fix it

Kubernetes
/tool/kubernetes/debugging-kubernetes-issues
100%
tool
Similar content

Debugging Windsurf: Fix Crashes, Memory Leaks & Errors

Practical guide for debugging crashes, memory leaks, and context confusion when Cascade stops working

Windsurf
/tool/windsurf/debugging-production-issues
95%
tool
Similar content

Trivy & Docker Security Scanner Failures: Debugging CI/CD Integration Issues

Troubleshoot common Docker security scanner failures like Trivy database timeouts or 'resource temporarily unavailable' errors in CI/CD. Learn to debug and fix

Docker Security Scanners (Category)
/tool/docker-security-scanners/troubleshooting-failures
92%
tool
Similar content

Solana Web3.js Guide: Versions, Installation, & Dev Tips

Master Solana Web3.js: Understand v1.x vs v2.0, installation, and real-world development. Get practical tips for building Solana dApps and Anchor compatibility.

Solana Web3.js
/tool/solana-web3js/overview
92%
tool
Similar content

Grok Code Fast 1: Emergency Production Debugging Guide

Learn how to use Grok Code Fast 1 for emergency production debugging. This guide covers strategies, playbooks, and advanced patterns to resolve critical issues

XAI Coding Agent
/tool/xai-coding-agent/production-debugging-guide
92%
tool
Similar content

Solana Web3.js v1.x to v2.0 Migration: A Comprehensive Guide

Navigate the Solana Web3.js v1.x to v2.0 migration with this comprehensive guide. Learn common pitfalls, environment setup, Node.js requirements, and troublesho

Solana Web3.js
/tool/solana-web3js/v1x-to-v2-migration-guide
90%
tool
Similar content

Arbitrum Production Debugging: Fix Gas & WASM Errors in Live Dapps

Real debugging for developers who've been burned by production failures

Arbitrum SDK
/tool/arbitrum-development-tools/production-debugging-guide
87%
tool
Similar content

React Production Debugging: Fix App Crashes & White Screens

Five ways React apps crash in production that'll make you question your life choices.

React
/tool/react/debugging-production-issues
85%
tool
Similar content

Cursor Background Agents & Bugbot Troubleshooting Guide

Troubleshoot common issues with Cursor Background Agents and Bugbot. Solve 'context too large' errors, fix GitHub integration problems, and optimize configurati

Cursor
/tool/cursor/agents-troubleshooting
85%
tool
Similar content

Solana Blockchain Overview: Speed, DeFi, Proof of History & How It Works

The blockchain that's fast when it doesn't restart itself, with decent dev tools if you can handle the occasional network outage

Solana
/tool/solana/overview
82%
tool
Similar content

Anchor Framework Performance Optimization: Master Solana Program Efficiency

No-Bullshit Performance Optimization for Production Anchor Programs

Anchor Framework
/tool/anchor/performance-optimization
82%
tool
Similar content

Anchor Framework Production Deployment: Debugging & Real-World Failures

The failures, the costs, and the late-night debugging sessions nobody talks about in the tutorials

Anchor Framework
/tool/anchor/production-deployment
80%
tool
Similar content

Neon Production Troubleshooting Guide: Fix Database Errors

When your serverless PostgreSQL breaks at 2AM - fixes that actually work

Neon
/tool/neon/production-troubleshooting
80%
tool
Similar content

OpenAI Browser: Optimize Performance for Production Automation

Making This Thing Actually Usable in Production

OpenAI Browser
/tool/openai-browser/performance-optimization-guide
80%
tool
Similar content

QuickNode Enterprise Migration Guide: From Self-Hosted to Stable

Migrated from self-hosted Ethereum/Solana nodes to QuickNode without completely destroying production

QuickNode
/tool/quicknode/enterprise-migration-guide
77%
tool
Similar content

Fix Common Xcode Build Failures & Crashes: Troubleshooting Guide

Solve common Xcode build failures, crashes, and performance issues with this comprehensive troubleshooting guide. Learn emergency fixes and debugging strategies

Xcode
/tool/xcode/troubleshooting-guide
75%
tool
Similar content

Django Troubleshooting Guide: Fix Production Errors & Debug

Stop Django apps from breaking and learn how to debug when they do

Django
/tool/django/troubleshooting-guide
72%
tool
Similar content

TaxBit Enterprise Production Troubleshooting: Debug & Fix Issues

Real errors, working fixes, and why your monitoring needs to catch these before 3AM calls

TaxBit Enterprise
/tool/taxbit-enterprise/production-troubleshooting
67%
tool
Similar content

Helm Troubleshooting Guide: Fix Deployments & Debug Errors

The commands, tools, and nuclear options for when your Helm deployment is fucked and you need to debug template errors at 3am.

Helm
/tool/helm/troubleshooting-guide
67%
tool
Similar content

Node.js Memory Leaks & Debugging: Stop App Crashes

Learn to identify and debug Node.js memory leaks, prevent 'heap out of memory' errors, and keep your applications stable. Explore common patterns, tools, and re

Node.js
/tool/node.js/debugging-memory-leaks
67%

Recommendations combine user behavior, content similarity, research intelligence, and SEO optimization