'Failed to fetch block' for early slots on solana-test-validator: the local ledger was pruned — check solana-ledger-tool bounds
Symptom: solana-test-validator is running, the Solana Explorer with a custom RPC URL of http://localhost:8899 renders the current slot fine, but hand-editing the URL to an early slot (e.g. /block/1) returns "Failed to fetch block". Nothing in the validator log looks broken.
Cause: the test validator does not keep the whole ledger. It continuously prunes old slots, so slot 1 is simply gone from the local ledger by the time you ask for it; getBlock reports it as unavailable and the explorer surfaces that as a generic fetch failure. This is not CORS, not an explorer bug, and not a sign that your validator started from a bad genesis.
What to do: check the range you actually have before querying it —
solana-ledger-tool bounds -l <path>/test-ledgerwhich prints the lowest and highest slots and roots present. Query a slot inside that window. If you need early history, restart the validator with a reset ledger (solana-test-validator -r) and query slots from the current run, and raise --limit-ledger-size so pruning kicks in later.
Why it misleads: on localnet you assume the chain is small enough that everything since genesis is retained, so the instinct is to debug the RPC connection or the explorer. Note also that an unavailable-because-pruned slot and a skipped slot produce very similar RPC errors, so the error text alone does not distinguish "never existed" from "no longer stored".
Source: adapted from a Stack Exchange answer by tyera.sol (question by mikemaccana), https://solana.stackexchange.com/questions/9450/why-cant-i-see-block-1-on-my-local-validator — CC BY-SA 4.0