{"record":{"id":"251d2bf5c2e1b5c0","repo":"hyperledger/fabric","slug":"envelope-has-no-header","errorCode":null,"errorMessage":"envelope has no header","messagePattern":"envelope has no header","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/deliver/deliver.go","lineNumber":370,"sourceCode":"\n\t\tif stopNum == block.Header.Number {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tlogger.Debugf(\"[channel: %s] Done delivering to %s for (%p)\", chdr.ChannelId, addr, seekInfo)\n\n\treturn cb.Status_SUCCESS, nil\n}\n\nfunc (h *Handler) parseEnvelope(ctx context.Context, envelope *cb.Envelope) (*cb.Payload, *cb.ChannelHeader, *cb.SignatureHeader, error) {\n\tpayload, err := protoutil.UnmarshalPayload(envelope.Payload)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\tif payload.Header == nil {\n\t\treturn nil, nil, nil, errors.New(\"envelope has no header\")\n\t}\n\n\tchdr, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\tshdr, err := protoutil.UnmarshalSignatureHeader(payload.Header.SignatureHeader)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\terr = h.validateChannelHeader(ctx, chdr)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\treturn payload, chdr, shdr, nil","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/deliver/deliver.go#L352-L388","documentation":"parseEnvelope in the deliver service (common/deliver/deliver.go) rejects an incoming Envelope whose inner Payload has no Header. Every deliver/Seek request must carry a header (channel + signature headers) so the handler can identify the channel, creator and request timing; without one the envelope cannot be routed or authenticated, so the handler aborts with this error.","triggerScenarios":"A client submits a deliver (SeekLatestBlock etc.) request whose Envelope.Payload marshals a pb.Payload with Header unset, or an envelope whose payload was hand-crafted/constructed without calling protoutil.WithChannelHeader/SignatureHeader (e.g. building the payload struct manually and forgetting the Header field).","commonSituations":"Custom CLI tools or test harnesses that build deliver envelopes by hand; a broken/misbehaving SDK producing empty payloads; corrupted or truncated protobuf bytes that still unmarshal but drop the header.","solutions":["Fix the client so it constructs the payload header via protoutil or SDK helpers, setting channel header (type, timestamp, channel ID) and signature header (creator, nonce).","Use an existing SDK (fabric-sdk-go/fabric-gateway) rather than hand-marshaling envelopes.","Inspect the offending envelope (protoutil.EnvelopeToPayload) to confirm the Header is nil and where it was produced."],"exampleFix":"// before\npayload := &cb.Payload{Data: data} // Header omitted\nenv := &cb.Envelope{Payload: protoutil.MarshalOrPanic(payload)}\n\n// after\nchdr := &cb.ChannelHeader{Type: int32(cb.HeaderType_DELIVER_SEEK_INFO), ChannelId: chID, TxId: txid}\nshdr := &cb.SignatureHeader{Creator: signerSerialised, Nonce: nonce}\nenv, err := protoutil.CreateEnvelope(protoutil.WithChannelHeader(chdr), protoutil.WithSignatureHeader(shdr), protoutil.WithData(data))","handlingStrategy":"validation","validationCode":"payload, err := protoutil.EnvelopeToPayload(envelope)\nif err != nil || payload == nil || payload.Header == nil {\n    return fmt.Errorf(\"deliver envelope lacks payload header; rebuild with protoutil.CreateEnvelope\")\n}","typeGuard":"func hasHeader(env *common.Envelope) bool {\n    p, err := protoutil.UnmarshalPayload(env.Payload)\n    return err == nil && p != nil && p.Header != nil\n}","tryCatchPattern":"payload, _, _, err := handler.parseEnvelope(ctx, env)\nif err != nil {\n    if strings.Contains(err.Error(), \"envelope has no header\") {\n        // rebuild the envelope client-side and resend\n    }\n    return err\n}","preventionTips":["Always build envelopes with protoutil.CreateEnvelope or an SDK, never raw struct marshaling","Unit-test deliver envelope construction to assert Header is set","Validate envelope shape at client boundaries before sending"],"tags":["hyperledger-fabric","protobuf","deliver","malformed-envelope"],"backgroundTag":"missing-required-header","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"}