RPC error -32010: Account excluded from secondary indexes
Last updated:
At a glance
| Property | Value |
|---|---|
| Code | -32010 |
| Message | Account excluded from secondary indexes |
| Category | account |
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
- 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.
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.