TriportRPC

Account excluded from secondary indexes (-32010)

Last updated:

At a glance

Error details
PropertyValue
Code-32010
MessageAccount excluded from secondary indexes
Categoryaccount

Cause

The account key is on the node's secondary-index exclusion list (high-cardinality keys like the Token program are excluded to bound index size), so a filtered `getProgramAccounts`/by-owner scan cannot use the index for it.

Solution

  1. Add narrower filters (`dataSize`, `memcmp`) so the query does not rely on the excluded key.
  2. Use `getTokenAccountsByOwner` for token-account lookups instead of a raw program scan.
  3. Query a node configured to index the key, or paginate with `getProgramAccountsV2`.

Example

{
  "id": 1,
  "error": {
    "code": -32010,
    "message": "Account TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA excluded from secondary indexes"
  },
  "jsonrpc": "2.0"
}

FAQ

Why does "Account excluded from secondary indexes" happen?
The account key is on the node's secondary-index exclusion list (high-cardinality keys like the Token program are excluded to bound index size), so a filtered `getProgramAccounts`/by-owner scan cannot use the index for it.
How do I fix "Account excluded from secondary indexes"?
Add narrower filters (`dataSize`, `memcmp`) so the query does not rely on the excluded key. Use `getTokenAccountsByOwner` for token-account lookups instead of a raw program scan. Query a node configured to index the key, or paginate with `getProgramAccountsV2`.
What is RPC error -32010?
-32010 means: Account excluded from secondary indexes. The account key is on the node's secondary-index exclusion list (high-cardinality keys like the Token program are excluded to bound index size), so a filtered `getProgramAccounts`/by-owner scan cannot use the index for it.