{"record":{"id":"528c5731604c950e","repo":"hyperledger/fabric","slug":"no-channel-header-in-payload","errorCode":null,"errorMessage":"no channel header in payload","messagePattern":"no channel header in payload","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/consensus/smartbft/util.go","lineNumber":266,"sourceCode":"}\n\nfunc (ri *RequestInspector) unwrapReqFromEnvelop(envelope *cb.Envelope) (*request, error) {\n\tpayload := &cb.Payload{}\n\tif err := proto.Unmarshal(envelope.Payload, payload); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed unmarshalling payload\")\n\t}\n\n\tif payload.Header == nil {\n\t\treturn nil, errors.Errorf(\"no header in payload\")\n\t}\n\n\tsigHdr := &cb.SignatureHeader{}\n\tif err := proto.Unmarshal(payload.Header.SignatureHeader, sigHdr); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(payload.Header.ChannelHeader) == 0 {\n\t\treturn nil, errors.New(\"no channel header in payload\")\n\t}\n\n\tchdr, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"error unmarshalling channel header\")\n\t}\n\n\treturn &request{\n\t\tchHdr:    chdr,\n\t\tsigHdr:   sigHdr,\n\t\tenvelope: envelope,\n\t}, nil\n}\n\n// remoteNodesFromConfigBlock unmarshalls the node config from the block metadata\nfunc remoteNodesFromConfigBlock(block *cb.Block, logger *flogging.FabricLogger, bccsp bccsp.BCCSP) (*nodeConfig, error) {\n\tenv := &cb.Envelope{}\n\tif err := proto.Unmarshal(block.Data.Data[0], env); err != nil {","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/consensus/smartbft/util.go#L248-L284","documentation":"unwrapReqFromEnvelop requires payload.Header.ChannelHeader to be non-empty and returns 'no channel header in payload' when len == 0. The ChannelHeader identifies the channel, tx type, and txid; without it the request's channel association cannot be determined. Note the SignatureHeader is decoded before this check, so the error only fires when a SignatureHeader exists but the ChannelHeader bytes are empty.","triggerScenarios":"A payload whose Header has SignatureHeader bytes but empty ChannelHeader bytes — typically a partially assembled header or a struct populated on only one side.","commonSituations":"Custom transaction builders setting only SignatureHeader; corrupted header bytes zeroing a field; older/foreign client SDKs producing non-standard payloads.","solutions":["Populate ChannelHeader via protoutil.MakeChannelHeader and include it in the payload header before signing/submitting","Decode the submitted payload with configtxlator to confirm which header fields are present","Regenerate the transaction with the Fabric SDK (node/java/go) instead of manual protobuf assembly","If received from a peer, drop the malformed request and investigate the sender"],"exampleFix":"// before\nhdr := &cb.Header{SignatureHeader: sigHdrBytes} // ChannelHeader empty\n// after\nchdr, _ := protoutil.MakeChannelHeader(cb.HeaderType_ENDORSER_TRANSACTION, 0, channelID, epoch)\nhdr := &cb.Header{ChannelHeader: chdrBytes, SignatureHeader: sigHdrBytes}","handlingStrategy":"validation","validationCode":"func hasChannelHeader(env *cb.Envelope) bool {\n    p := &cb.Payload{}\n    if env == nil || proto.Unmarshal(env.Payload, p) != nil || p.Header == nil {\n        return false\n    }\n    return len(p.Header.ChannelHeader) > 0\n}","typeGuard":"func hasChannelHeaderBytes(h *cb.Header) bool { return h != nil && len(h.ChannelHeader) > 0 }","tryCatchPattern":"req, err := unwrap(raw)\nif err != nil {\n    if strings.Contains(err.Error(), \"no channel header in payload\") {\n        return nil, fmt.Errorf(\"payload missing channel header: %w\", err)\n    }\n    return nil, err\n}","preventionTips":["Always set ChannelHeader (protoutil.MakeChannelHeader) alongside SignatureHeader","Decode submitted envelopes with configtxlator before sending to verify structure","Use official Fabric SDKs rather than manual protobuf assembly"],"tags":["hyperledger-fabric","smartbft","missing-header","channel-header","payload-validation"],"backgroundTag":"missing-channel-header","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"}