{"record":{"id":"4c8a312be991132b","repo":"hyperledger/fabric","slug":"invalid-config-envelope","errorCode":null,"errorMessage":"invalid config envelope","messagePattern":"invalid config envelope","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/deliverclient/util.go","lineNumber":36,"sourceCode":"// 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 {\n\t\treturn nil, errors.New(\"nil header in payload\")\n\t}\n\tchdr, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tif common.HeaderType(chdr.Type) != common.HeaderType_CONFIG {\n\t\treturn nil, ErrNotAConfig\n\t}\n\tconfigEnvelope, err := configtx.UnmarshalConfigEnvelope(payload.Data)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"invalid config envelope\")\n\t}\n\treturn configEnvelope, nil","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/deliverclient/util.go#L18-L54","documentation":"Returned by deliverclient.ConfigFromBlock for the genesis block (number 0) when configtx.UnmarshalConfigEnvelope fails to decode the payload data as a ConfigEnvelope. A block-0 payload that is not a valid config envelope is treated as an invalid genesis block.","triggerScenarios":"Thrown at common/deliverclient/util.go:36 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped protobuf error","Regenerate or re-obtain the genesis block from a trusted source"],"exampleFix":null,"handlingStrategy":"try-catch","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"}