Error Messages

Comprehensive guide to understanding and handling error messages in the Gorbag wallet adapter.

Common Connection Errors

"Wallet not found"

Cause: The Gorbag wallet extension is not installed or not enabled in the browser.

Solution: Install the Gorbag wallet extension from the official website and ensure it's enabled.

"User rejected the request"

Cause: The user denied the connection request in the wallet popup.

Solution: Accept the connection request. This is normal user interaction, not an error.

"Wallet is not connected"

Cause: Attempting to perform wallet operations without an active connection.

Solution: Check if wallet.connected is true before performing operations.

Transaction Errors

"Blockhash not found"

Cause: The transaction blockhash expired before confirmation.

Solution: Fetch a new blockhash and retry the transaction:

TYPESCRIPT
1// Get a fresh blockhash
2const { blockhash } = await connection.getLatestBlockhash();
3transaction.recentBlockhash = blockhash;

"Insufficient funds"

Cause: Attempting to send more tokens than available in the account.

Solution: Check account balance before sending transactions:

TYPESCRIPT
1// Check balance before sending
2const balance = await connection.getBalance(publicKey);
3const requiredAmount = amountInLamports + feeEstimate;
4
5if (balance < requiredAmount) {
6 throw new Error('Insufficient funds');
7}

"Transaction signature verification failure"

Cause: The transaction wasn't properly signed by the required accounts.

Solution: Ensure all required signers have signed the transaction before sending.

Network and RPC Errors

"Network request failed"

Cause: Unable to connect to the RPC endpoint, possibly due to network issues or endpoint being down.

Solution: Check your internet connection and verify the RPC endpoint is correct and accessible.

"Block height exceeded"

Cause: The transaction exceeded the maximum block height limit.

Solution: Create a new transaction with the latest blockhash.

"Account not found"

Cause: Attempting to interact with an account that doesn't exist on the network.

Solution: Verify the account address is correct and the account has been created.

Error Handling Best Practices

Implement comprehensive error handling in your dApp:

TYPESCRIPT
1import { useConnection, useWallet } from '@solana/wallet-adapter-react';
2
3export function handleError(error: any) {
4 // Log the full error for debugging
5 console.error('Wallet operation error:', error);
6
7 // Categorize and handle different error types
8 if (error.message?.includes('user rejected')) {
9 // User canceled, show user-friendly message
10 showNotification('Transaction canceled by user');
11 } else if (error.message?.includes('insufficient funds')) {
12 // Insufficient funds
13 showNotification('Insufficient funds for this transaction');
14 } else if (error.message?.includes('blockhash')) {
15 // Blockhash expired, retry with new blockhash
16 showNotification('Transaction expired, please try again');
17 } else {
18 // Generic error
19 showNotification('An error occurred. Please try again.');
20 }
21}
22
23export async function safeTransaction() {
24 try {
25 // Perform wallet operation
26 const signature = await sendTransaction(transaction, connection);
27 console.log('Transaction successful:', signature);
28 } catch (error) {
29 handleError(error);
30 }
31}

Debugging Tools

Use these tools and techniques to debug wallet adapter issues:

  • Check browser console for detailed error messages
  • Use wallet adapter's built-in logging by setting debug mode
  • Verify network connection and RPC endpoint status
  • Check account balances and states on Official Block Explorer
  • Use Solana's CLI tools to verify transactions