{"record":{"id":"99419434a8cdf84d","repo":"hyperledger/fabric","slug":"block-is-nil","errorCode":null,"errorMessage":"block is nil","messagePattern":"block is nil","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/cluster/deliver.go","lineNumber":459,"sourceCode":"\tif err != nil {\n\t\tp.Logger.Warningf(\"Failed establishing deliver stream with %s\", endpoint)\n\t\treturn nil, err\n\t}\n\n\tif err = stream.Send(env); err != nil {\n\t\tp.Logger.Errorf(\"Failed sending seek envelope to %s: %v\", endpoint, err)\n\t\tstream.abort()\n\t\treturn nil, err\n\t}\n\treturn stream, nil\n}\n\nfunc extractBlockFromResponse(resp *orderer.DeliverResponse) (*common.Block, error) {\n\tswitch t := resp.Type.(type) {\n\tcase *orderer.DeliverResponse_Block:\n\t\tblock := t.Block\n\t\tif block == nil {\n\t\t\treturn nil, errors.New(\"block is nil\")\n\t\t}\n\t\tif block.Data == nil {\n\t\t\treturn nil, errors.New(\"block data is nil\")\n\t\t}\n\t\tif block.Header == nil {\n\t\t\treturn nil, errors.New(\"block header is nil\")\n\t\t}\n\t\tif block.Metadata == nil || len(block.Metadata.Metadata) == 0 {\n\t\t\treturn nil, errors.New(\"block metadata is empty\")\n\t\t}\n\t\treturn block, nil\n\tcase *orderer.DeliverResponse_Status:\n\t\tif t.Status == common.Status_FORBIDDEN {\n\t\t\treturn nil, ErrForbidden\n\t\t}\n\t\tif t.Status == common.Status_SERVICE_UNAVAILABLE {\n\t\t\treturn nil, ErrServiceUnavailable\n\t\t}","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/cluster/deliver.go#L441-L477","documentation":"extractBlockFromResponse unwraps a DeliverResponse of type Block. If the Block message inside the response is nil, there is no block to process, and the helper rejects it with this error rather than panicking downstream.","triggerScenarios":"pullBlocks or fetchLastBlockSeq received a DeliverResponse_Block whose Block field is nil — a malformed or empty block response from the remote deliver service.","commonSituations":"Malfunctioning or buggy remote orderer sending empty block envelopes; truncated/corrupt gRPC message; middleware/proxy stripping payload fields.","solutions":["Retry the block fetch (the puller advances to the next response/reconnects)","Inspect the remote orderer logs for why it emitted an empty block response","Verify no proxy/intermediary is corrupting the deliver stream between nodes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if resp.GetType() == &orderer.DeliverResponse_Block{} && resp.GetBlock() == nil {\n    return fmt.Errorf(\"received empty block response\")\n}","typeGuard":"func isUsableBlock(resp *orderer.DeliverResponse) bool {\n    b := resp.GetBlock()\n    return b != nil && b.Data != nil && b.Header != nil && b.Metadata != nil && len(b.Metadata.Metadata) > 0\n}","tryCatchPattern":"block, err := extractBlockFromResponse(resp)\nif err != nil {\n    log.Errorf(\"bad block from %s: %v\", endpoint, err)\n    return err // puller will retry/advance\n}","preventionTips":["Validate all block sections (data, header, metadata) before committing","Prefer well-known healthy orderers as pull sources","Keep fabric binaries at consistent versions cluster-wide"],"tags":["deliver","block-sync","malformed-response"],"backgroundTag":"malformed-block-response","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"}