{"record":{"id":"fea400a9e43a4d06","repo":"hyperledger/fabric","slug":"could-not-retrieve-config-block-from-index-d","errorCode":null,"errorMessage":"could not retrieve config block from index %d","messagePattern":"could not retrieve config block from index (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/follower/follower_chain.go","lineNumber":591,"sourceCode":"\t\t}\n\t}\n\tc.logger.Debugf(\"Pulled blocks from %d to %d\", firstBlockToPull, targetHeight)\n\treturn targetHeight - firstBlockToPull, nil\n}\n\nfunc (c *Chain) loadLastConfig() error {\n\theight := c.ledgerResources.Height()\n\tif height == 0 {\n\t\treturn errors.New(\"ledger is empty\")\n\t}\n\tlastBlock := c.ledgerResources.Block(height - 1)\n\tindex, err := protoutil.GetLastConfigIndexFromBlock(lastBlock)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"chain does have appropriately encoded last config in its latest block\")\n\t}\n\tlastConfig := c.ledgerResources.Block(index)\n\tif lastConfig == nil {\n\t\treturn errors.Errorf(\"could not retrieve config block from index %d\", index)\n\t}\n\tc.lastConfig = lastConfig\n\treturn nil\n}\n","sourceCodeStart":573,"sourceCodeEnd":596,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/follower/follower_chain.go#L573-L596","documentation":"After finding the last config index encoded in the latest block, loadLastConfig tries to fetch that config block from the ledger and gets nil. The latest block claims a last-config index that the ledger cannot serve, so the stored last configuration cannot be loaded.","triggerScenarios":"loadLastConfig: protoutil.GetLastConfigIndexFromBlock(lastBlock) succeeds returning `index`, but c.ledgerResources.Block(index) returns nil — the referenced config block is missing from the ledger (truncation/pruning past the config block, or corrupted block index).","commonSituations":"Ledger files partially deleted or rolled back so the referenced config block no longer exists; corrupted index DB after unclean shutdown; a manually copied/mixed ledger directory where the newest block references config from a different ledger generation.","solutions":["Reset/rollback the ledger to a consistent point (orderer rollback to a height where the config block exists) and re-sync from the ordering service.","Restore the ledger from a snapshot or backup that includes the referenced config block.","Check the block index storage (leveldb) for corruption; rebuild by re-pulling blocks via pullAfterJoin from a clean state.","Re-join the channel entirely if the local ledger is unrecoverable, using a fresh join block."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if idx, err := protoutil.GetLastConfigIndexFromBlock(lastBlock); err == nil { if idx >= ledgerResources.Height() { return errors.Errorf(\"last-config index %d out of range\", idx) } }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"could not retrieve config block from index\") { rollback ledger / restore snapshot, then re-sync }","preventionTips":["Avoid truncating the ledger past its last config block","Perform clean shutdowns to protect block index DB integrity","Keep recent ledger snapshots containing config blocks","After unclean crashes, verify index consistency before restarting"],"tags":["orderer","fabric","ledger-consistency","config-block"],"backgroundTag":"ledger-block-missing","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"}