canopy-network/canopy · error · ErrStoreGet
ErrStoreGet
ErrStoreGet
Error message
block not found
What it means
The indexer's getBlock looked up a block by its key (hash or height) in the store DB and found an empty value. The library throws this because the requested block does not exist in the indexer's database. It surfaces from the public getters GetBlockByHash, GetBlockByHeight, GetBlockHeaderByHeight, and getBlockForPage.
Source
Thrown at store/indexer.go:886
if len(bz) == 0 {
return nil, ErrStoreGet(errors.New("quorum certificate not found"))
}
// convert to QC object
ptr := new(lib.QuorumCertificate)
if err = lib.Unmarshal(bz, ptr); err != nil {
return nil, err
}
return ptr, nil
}
// getBlock() gets the block bytes from the DB and converts it into a filled BlockResult object including the transactions
func (t *Indexer) getBlock(hashKey []byte, transactions bool) (*lib.BlockResult, lib.ErrorI) {
bz, err := t.db.Get(hashKey)
if err != nil {
return nil, err
}
if len(bz) == 0 {
return nil, ErrStoreGet(errors.New("block not found"))
}
ptr := new(lib.BlockHeader)
if err = lib.Unmarshal(bz, ptr); err != nil {
return nil, err
}
if !transactions {
result := &lib.BlockResult{
BlockHeader: ptr,
}
resultBz, err := lib.Marshal(result)
if err != nil {
return nil, err
}
result.Meta = &lib.BlockResultMeta{Size: uint64(len(resultBz))}
return result, nil
}
txs, err := t.GetTxsByHeightNonPaginated(ptr.Height, false)
if err != nil {View on GitHub (pinned to ee8197d91d)
Solutions
- Verify the requested block hash or height actually exists on this chain (e.g. via a block explorer or a lower, known-good height)
- Check that the node is fully synced; query a height <= current tip
- If looking up by hash, confirm the exact indexed byte/hash form is used
- Re-sync or rebuild the indexer DB if blocks were pruned or the data directory is stale
Example fix
// before
blk, err := indexer.GetBlockByHeight(ctx, 999999999) // tip is 10500
// after
tip, _ := indexer.GetHeight(ctx)
if height > tip { return fmt.Errorf("height %d not yet indexed (tip=%d)", height, tip) }
blk, err := indexer.GetBlockByHeight(ctx, height) Defensive patterns
Strategy: validation
Validate before calling
// check height bounds before querying
tip := indexerTip()
if height > tip || height < 1 {
return fmt.Errorf("height %d out of indexed range (1..%d)", height, tip)
} Type guard
func hasBlock(bz []byte) bool { return len(bz) > 0 } Try / catch
blk, err := indexer.GetBlockByHeight(ctx, h)
if err != nil {
if strings.Contains(err.Error(), "block not found") {
return nil, ErrUnknownBlock{Height: h}
}
return err
} Prevention
- Track the indexed tip and clamp queries to it
- Normalize block hashes to the exact indexed byte form
- Monitor sync status before serving reads
When it happens
Trigger: Calling GetBlockByHash with a hash of a block never indexed, GetBlockByHeight/GetBlockHeaderByHeight with a height above the chain tip or before genesis, or getBlockForPage for a page past the end of stored blocks.
Common situations: Querying a node that has not synced to the requested height, querying a different chain than the one that produced the block, typos in a hex block hash, or pruning/indexing settings that removed the block.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- event not found
- quorum certificate not found
- nested transactions are not supported
- rollback is not supported for nested transactions
- rollback target height must be >= 1
AI-assisted analysis of canopy-network/canopy@ee8197d91d (2026-09-06).
Data as JSON: /api/errors/85663b8e0337c60b.
Report an issue: GitHub.