{"record":{"id":"85663b8e0337c60b","repo":"canopy-network/canopy","slug":"errstoreget","errorCode":"ErrStoreGet","errorMessage":"block not found","messagePattern":"block not found","errorType":"error_code","errorClass":"ErrStoreGet","httpStatus":null,"severity":"error","filePath":"store/indexer.go","lineNumber":886,"sourceCode":"\tif len(bz) == 0 {\n\t\treturn nil, ErrStoreGet(errors.New(\"quorum certificate not found\"))\n\t}\n\t// convert to QC object\n\tptr := new(lib.QuorumCertificate)\n\tif err = lib.Unmarshal(bz, ptr); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ptr, nil\n}\n\n// getBlock() gets the block bytes from the DB and converts it into a filled BlockResult object including the transactions\nfunc (t *Indexer) getBlock(hashKey []byte, transactions bool) (*lib.BlockResult, lib.ErrorI) {\n\tbz, err := t.db.Get(hashKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(bz) == 0 {\n\t\treturn nil, ErrStoreGet(errors.New(\"block not found\"))\n\t}\n\tptr := new(lib.BlockHeader)\n\tif err = lib.Unmarshal(bz, ptr); err != nil {\n\t\treturn nil, err\n\t}\n\tif !transactions {\n\t\tresult := &lib.BlockResult{\n\t\t\tBlockHeader: ptr,\n\t\t}\n\t\tresultBz, err := lib.Marshal(result)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult.Meta = &lib.BlockResultMeta{Size: uint64(len(resultBz))}\n\t\treturn result, nil\n\t}\n\ttxs, err := t.GetTxsByHeightNonPaginated(ptr.Height, false)\n\tif err != nil {","sourceCodeStart":868,"sourceCodeEnd":904,"githubUrl":"https://github.com/canopy-network/canopy/blob/ee8197d91dd410f6592cb650a94c925ee6dc8bad/store/indexer.go#L868-L904","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nblk, err := indexer.GetBlockByHeight(ctx, 999999999) // tip is 10500\n// after\ntip, _ := indexer.GetHeight(ctx)\nif height > tip { return fmt.Errorf(\"height %d not yet indexed (tip=%d)\", height, tip) }\nblk, err := indexer.GetBlockByHeight(ctx, height)","handlingStrategy":"validation","validationCode":"// check height bounds before querying\ntip := indexerTip()\nif height > tip || height < 1 {\n    return fmt.Errorf(\"height %d out of indexed range (1..%d)\", height, tip)\n}","typeGuard":"func hasBlock(bz []byte) bool { return len(bz) > 0 }","tryCatchPattern":"blk, err := indexer.GetBlockByHeight(ctx, h)\nif err != nil {\n    if strings.Contains(err.Error(), \"block not found\") {\n        return nil, ErrUnknownBlock{Height: h}\n    }\n    return err\n}","preventionTips":["Track the indexed tip and clamp queries to it","Normalize block hashes to the exact indexed byte form","Monitor sync status before serving reads"],"tags":["store","blockchain","not-found","database"],"backgroundTag":"record-not-found","analyzedSha":"ee8197d91dd410f6592cb650a94c925ee6dc8bad","analyzedAt":"2026-09-06T09:30:15.973Z","contentChangedAt":"2026-09-06T09:30:15.973Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}