{"record":{"id":"3f4dcb82481bbb65","repo":"hyperledger/fabric","slug":"empty-block","errorCode":null,"errorMessage":"empty block","messagePattern":"empty block","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/deliverclient/util.go","lineNumber":22,"sourceCode":"SPDX-License-Identifier: Apache-2.0\n*/\n\npackage deliverclient\n\nimport (\n\t\"github.com/hyperledger/fabric-protos-go-apiv2/common\"\n\t\"github.com/hyperledger/fabric/common/configtx\"\n\t\"github.com/hyperledger/fabric/protoutil\"\n\t\"github.com/pkg/errors\"\n)\n\nvar ErrNotAConfig = errors.New(\"not a config block\")\n\n// ConfigFromBlock returns a ConfigEnvelope if exists, or a *ErrNotAConfig error.\n// It may also return some other error in case parsing failed.\nfunc ConfigFromBlock(block *common.Block) (*common.ConfigEnvelope, error) {\n\tif block == nil || block.Data == nil || len(block.Data.Data) == 0 {\n\t\treturn nil, errors.New(\"empty block\")\n\t}\n\ttxn := block.Data.Data[0]\n\tenv, err := protoutil.GetEnvelopeFromBlock(txn)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tpayload, err := protoutil.UnmarshalPayload(env.Payload)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tif block.Header.Number == 0 {\n\t\tconfigEnvelope, err := configtx.UnmarshalConfigEnvelope(payload.Data)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"invalid config envelope\")\n\t\t}\n\t\treturn configEnvelope, nil\n\t}\n\tif payload.Header == nil {","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/deliverclient/util.go#L4-L40","documentation":"Returned by deliverclient.ConfigFromBlock when the block, its Data, or its data array is empty/nil. It is the guard for 'this block cannot possibly contain a config envelope', used by callers to distinguish non-config blocks from parse failures.","triggerScenarios":"Thrown at common/deliverclient/util.go:22 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-empty, well-formed block","Re-fetch the block from the orderer/peer if it was truncated in transit"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}