Troubleshooting Guide

Solutions to common issues when working with Saros SDKs and Solana development.

Getting Help

If you're experiencing issues not covered in this guide, here are the best ways to get help:

Discord Community

Join our Discord server to ask questions and get help from other developers.

Join Discord
GitHub Issues

Report bugs or request features on our GitHub repositories.

View Issues

Common Issues and Solutions

Connection Issues

Cannot connect to Solana network
Problem: Your application fails to establish a connection to the Solana network.

Solution:

Ensure you're using the correct RPC endpoint:

// For Devnet
const connection = new Connection(clusterApiUrl('devnet'));

// For Mainnet
const connection = new Connection(clusterApiUrl('mainnet-beta'));

// For a custom RPC provider
const connection = new Connection('https://your-rpc-provider.com');
clusterApiUrl('devnet')
Slow or timeout connections
Problem: Transactions are taking too long or timing out.

Solution:

Try using a more reliable RPC endpoint or a dedicated provider:

// Try different endpoints
const connection = new Connection('https://solana-devnet.g.alchemy.com/solana/v1/xyz123');

// Or use a local validator for development
// solana-test-validator (run in terminal)
solana-test-validator

Wallet Issues

Wallet not connecting
Problem: The wallet connection process fails or the wallet is not detected.

Solution:

Ensure you have a wallet adapter properly configured:

import { PhantomWalletAdapter } from '@solana/wallet-adapter-wallets';
import { useWallet } from '@solana/wallet-adapter-react';

// Initialize wallets
const wallets = useMemo(
  () => [
    new PhantomWalletAdapter(),
    // Add other wallet adapters here
  ],
  []
);

// Use the wallet in your component
const { connected, publicKey } = useWallet();
useWallet()
Insufficient funds for transaction fees
Problem: Transactions fail with an insufficient funds error.

Solution:

Check your wallet balance and get more SOL if needed:

// Check balance
const balance = await connection.getBalance(wallet.publicKey);

// Get Devnet SOL
// Visit https://solfaucet.com/ or use:
// solana airdrop 1 <WALLET_ADDRESS> --url devnet
solana airdrop 1

Token and Pool Issues

Token accounts not found
Problem: Operations fail because token accounts don't exist.

Solution:

Create token accounts before using tokens:

import { getOrCreateAssociatedTokenAccount } from '@solana/spl-token';

const tokenAccount = await getOrCreateAssociatedTokenAccount(
  connection,
  payer, // Transaction payer
  mint, // Token mint address
  owner // Token owner
);
getOrCreateAssociatedTokenAccount
Invalid pool addresses
Problem: Swap or liquidity operations fail with invalid pool errors.

Solution:

Verify pool addresses are correct for the network:

// For Devnet, use Devnet pool addresses
// For Mainnet, use Mainnet pool addresses

// You can query available pools:
const pools = await SarosFarmService.getListPool({ page: 1, size: 10 });
getListPool

Transaction Issues

Transaction simulation failed
Problem: Transactions fail during simulation with generic errors.

Solution:

Check transaction parameters and account balances:

1. Verify all account addresses are correct
2. Ensure sufficient token balances
3. Check slippage settings
4. Verify pool parameters

// Add detailed error logging
try {
  const result = await someSarosOperation();
} catch (error) {
  console.error('Transaction error:', error);
  console.error('Error code:', error.code);
  console.error('Error message:', error.message);
}
console.error(error)
Slippage tolerance exceeded
Problem: Swap transactions fail due to slippage protection.

Solution:

Increase slippage tolerance or try with smaller amounts:

// Adjust slippage tolerance (in percentage)
const slippage = 1.0; // 1% instead of 0.5%

// Or break large swaps into smaller transactions
const amount = 0.1; // Smaller amount
slippage = 1.0
Debugging Tips

1. Enable Detailed Logging

Add console.log statements throughout your code to track the flow of execution and identify where issues occur.

2. Use Solana Explorer

Check transaction details on Solana Explorer to see error messages and transaction information.

3. Test with Smaller Amounts

When testing swaps or liquidity operations, start with small token amounts to reduce the impact of errors.

4. Validate Addresses

Ensure all Solana addresses (wallets, tokens, pools) are valid and exist on the correct network.

Pro Tip

Use the Saros Playground to test code snippets in isolation before integrating them into your application.