{"record":{"id":"983690c9b3fb7d2d","repo":"hyperledger/fabric","slug":"unable-to-retrieve-block-d","errorCode":null,"errorMessage":"unable to retrieve block [%d]","messagePattern":"unable to retrieve block \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/consensus/etcdraft/blockpuller.go","lineNumber":54,"sourceCode":"\n// EndpointconfigFromSupport extracts TLS CA certificates and endpoints from the ConsenterSupport\nfunc EndpointconfigFromSupport(support consensus.ConsenterSupport, bccsp bccsp.BCCSP) ([]cluster.EndpointCriteria, error) {\n\tlastConfigBlock, err := lastConfigBlockFromSupport(support)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tendpointconf, err := cluster.EndpointconfigFromConfigBlock(lastConfigBlock, bccsp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn endpointconf, nil\n}\n\nfunc lastConfigBlockFromSupport(support consensus.ConsenterSupport) (*common.Block, error) {\n\tlastBlockSeq := support.Height() - 1\n\tlastBlock := support.Block(lastBlockSeq)\n\tif lastBlock == nil {\n\t\treturn nil, errors.Errorf(\"unable to retrieve block [%d]\", lastBlockSeq)\n\t}\n\tlastConfigBlock, err := cluster.LastConfigBlock(lastBlock, support)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn lastConfigBlock, nil\n}\n\n// NewBlockPuller creates a new block puller\nfunc NewBlockPuller(support consensus.ConsenterSupport,\n\tbaseDialer *cluster.PredicateDialer,\n\tclusterConfig localconfig.Cluster,\n\tbccsp bccsp.BCCSP,\n) (BlockPuller, error) {\n\tverifyBlockSequence := func(blocks []*common.Block, _ string) error {\n\t\tvb := cluster.BlockVerifierBuilder(bccsp)\n\t\treturn cluster.VerifyBlocksBFT(blocks, support.SignatureVerifier(), vb)\n\t}","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/consensus/etcdraft/blockpuller.go#L36-L72","documentation":"lastConfigBlockFromSupport tries to fetch the most recent block from the ledger (support.Block(height-1)) to locate the last configuration block. If the ledger returns nil for the last block index, it means the ledger is shorter than reported or the block cannot be read, so the etcdraft consenter cannot determine cluster endpoints and aborts. This uses pkg/errors.Errorf (formatted, with stack trace).","triggerScenarios":"Calling EndpointconfigFromSupport (e.g., when a chain starts or a cluster membership change requires endpoint extraction) when support.Height() > 0 but support.Block(lastBlockSeq) returns nil — e.g., ledger truncation, corruption, or a block still being committed.","commonSituations":"Orderer ledger files corrupted or truncated (disk issues, crash during write); height/ledger inconsistency after snapshot restore; asking for endpoint config on a channel whose ledger is not fully initialized.","solutions":["Inspect the orderer logs for ledger errors and verify the channel ledger files under FileLedger are intact.","Re-sync the channel: remove the channel from the participation API and re-join (or restore from a valid snapshot).","Check disk space and filesystem health on the orderer node; corrupted block files must be replaced from a healthy peer/orderer.","Verify support.Height() matches the actual number of blocks retrievable; report a bug if the ledger reports a height for blocks it cannot serve."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"lastSeq := support.Height() - 1\nif lastSeq < 0 {\n    return errors.New(\"channel ledger empty\")\n}\nif support.Block(lastSeq) == nil {\n    return errors.Errorf(\"ledger cannot serve last block %d\", lastSeq)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Monitor ledger integrity and disk health on orderers","Never hand-edit or partially copy FileLedger directories","Restore channels from validated snapshots"],"tags":["orderer","etcdraft","ledger","raft"],"backgroundTag":"ledger-block-not-found","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}