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
- No filters. Calling
getProgramAccountswithoutmemcmpordataSizefilters forces a full scan of all accounts. - Broad filters. Filters that match too many accounts still return too much data.
- RPC provider limits. Most providers cap
getProgramAccountsexecution time at 30-60 seconds, or block it entirely for large programs. - Public RPC. The public endpoint has the strictest limits for heavy methods.
How to fix
- Add filters. Always use
dataSizeandmemcmpfilters to narrow the scan. - Use a dedicated node or a provider that allows longer-running
getProgramAccountsqueries like Supanode’s data infrastructure. - 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
| Approach | When to use |
|---|---|
| getTokenAccountsByOwner | Find token accounts for a specific wallet |
| gRPC / Yellowstone | Subscribe to account changes in real time |
| Indexed databases | Historical queries, analytics, dashboards |
| DAS API | NFT 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: