in-solana by Supanode

getProgramAccounts request timed out

The getProgramAccounts call exceeded the RPC node’s timeout or memory limit. This method scans every account owned by a program, and popular programs (Token, Token-2022) own millions of accounts.

Common causes

  1. No filters. Calling getProgramAccounts without memcmp or dataSize filters forces a full scan of all accounts.
  2. Broad filters. Filters that match too many accounts still return too much data.
  3. RPC provider limits. Most providers cap getProgramAccounts execution time at 30-60 seconds, or block it entirely for large programs.
  4. Public RPC. The public endpoint has the strictest limits for heavy methods.

How to fix

  1. Add filters. Always use dataSize and memcmp filters to narrow the scan.
  2. Use a dedicated node or a provider that allows longer-running getProgramAccounts queries like Supanode’s data infrastructure.
  3. Use alternative approaches when possible:
import { createSolanaRpc, address } from "@solana/kit";

const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");

// BAD: no filters — scans ALL token accounts
// const all = await rpc.getProgramAccounts(TOKEN_PROGRAM).send();

// GOOD: filter by owner (memcmp at offset 32 for SPL Token)
const filtered = await rpc.getProgramAccounts(
  address("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
  {
    filters: [
      { dataSize: 165n },
      { memcmp: { offset: 32n, bytes: "YOUR_WALLET_BASE58" } },
    ],
    encoding: "base64",
  }
).send();

Alternatives to getProgramAccounts

ApproachWhen to use
getTokenAccountsByOwnerFind token accounts for a specific wallet
gRPC / YellowstoneSubscribe to account changes in real time
Indexed databasesHistorical queries, analytics, dashboards
DAS APINFT and compressed NFT queries

FAQ

Can I increase the timeout? On a self-hosted node, you can adjust the --rpc-scan-and-fix-roots-slots-per-second and related configuration. On hosted providers, the timeout is fixed by the provider.

Why do providers limit this method? A single getProgramAccounts call without filters can scan millions of accounts, consuming significant CPU and memory. It affects all other users on the same node.

Is getProgramAccounts deprecated? No, but it is an expensive operation. For many use cases, specialized endpoints (getTokenAccountsByOwner, gRPC subscriptions, indexed databases) are faster and more reliable.

Error text variants

  • getProgramAccounts request timed out
  • scan was aborted
  • request timed out

Updated: