{"record":{"id":"6594b8c18f418538","repo":"hyperledger/fabric","slug":"not-a-config-block","errorCode":null,"errorMessage":"not a config block","messagePattern":"not a config block","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/deliverclient/util.go","lineNumber":16,"sourceCode":"/*\nCopyright IBM Corp. All Rights Reserved.\n\nSPDX-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)","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/deliverclient/util.go#L1-L34","documentation":"Sentinel ErrNotAConfig returned by ConfigFromBlock when the block's first transaction is not a CONFIG-type transaction — callers compare against this exact error to distinguish 'wrong kind of block' from real parse failures.","triggerScenarios":"Thrown at common/deliverclient/util.go:16 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a config block (genesis or a config-update block) instead of a data block","Skip the block when ErrNotAConfig is returned, as cluster/util.go does"],"exampleFix":null,"handlingStrategy":"type-guard","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-08T15:18:49.778Z"}