{"record":{"id":"24b148d3ffa7934d","repo":"hyperledger/fabric","slug":"bad-header-24b148","errorCode":null,"errorMessage":"bad header","messagePattern":"bad header","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/consensus/smartbft/signature.go","lineNumber":63,"sourceCode":"\treturn msg2Sign\n}\n\n// ProposalToBlock marshals the proposal the block\nfunc ProposalToBlock(proposal types.Proposal) (*cb.Block, error) {\n\t// initialize block with empty fields\n\tblock := &cb.Block{\n\t\tData:     &cb.BlockData{},\n\t\tMetadata: &cb.BlockMetadata{},\n\t}\n\n\tif len(proposal.Header) == 0 {\n\t\treturn nil, errors.New(\"proposal header cannot be nil\")\n\t}\n\n\thdr := &asn1Header{}\n\n\tif _, err := asn1.Unmarshal(proposal.Header, hdr); err != nil {\n\t\treturn nil, errors.Wrap(err, \"bad header\")\n\t}\n\n\tblock.Header = &cb.BlockHeader{\n\t\tNumber:       hdr.Number.Uint64(),\n\t\tPreviousHash: hdr.PreviousHash,\n\t\tDataHash:     hdr.DataHash,\n\t}\n\n\tif len(proposal.Payload) == 0 {\n\t\treturn nil, errors.New(\"proposal payload cannot be nil\")\n\t}\n\n\ttuple := &ByteBufferTuple{}\n\tif err := tuple.FromBytes(proposal.Payload); err != nil {\n\t\treturn nil, errors.Wrap(err, \"bad payload and metadata tuple\")\n\t}\n\n\tif err := proto.Unmarshal(tuple.A, block.Data); err != nil {","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/consensus/smartbft/signature.go#L45-L81","documentation":"While converting a SmartBFT proposal to a block, the proposal Header bytes failed ASN.1 unmarshalling into the internal asn1Header struct. The header is present but not decodable, so the error wraps the asn1 failure with the context 'bad header'.","triggerScenarios":"VerifyProposal/SignProposal/RequestsFromProposal/Deliver called with a Proposal whose Header is corrupted, truncated, or was produced by an incompatible encoding version (not the ASN.1 asn1Header layout).","commonSituations":"Binary corruption during backup/restore or WAL replay; version skew between Fabric binaries after an upgrade where header encoding changed; hand-crafted or replayed messages injected by a malicious or buggy peer.","solutions":["Verify the Fabric binaries on all consenters are the same version (peer/orderer version alignment).","Delete corrupted local state and re-sync the channel from other consenters (restart the orderer to trigger synchronization).","Check storage integrity (WAL/ledger files) on the node; restore from a healthy snapshot/backup if corruption is confirmed.","If the data came from the network, inspect whether a peer is sending malformed messages and verify TLS/cluster communication integrity."],"exampleFix":"// before\n// consuming a proposal from an old, incompatible WAL entry\nprop := readFromWALUnchecked()\nblock, err := ProposalToBlock(prop)\n\n// after\n// validate source and re-sync if version skew suspected\nif !sameFabricVersion(clusterPeers) {\n    return resyncFromQuorum()\n}\nblock, err := ProposalToBlock(prop)","handlingStrategy":"validation","validationCode":"hdr := &asn1Header{}\nif _, err := asn1.Unmarshal(prop.Header, hdr); err != nil {\n    return fmt.Errorf(\"proposal header not ASN.1 decodable: %v\", err)\n}\nblock, err := ProposalToBlock(prop)","typeGuard":"func headerDecodable(p types.Proposal) bool {\n    hdr := &asn1Header{}\n    _, err := asn1.Unmarshal(p.Header, hdr)\n    return err == nil && hdr.Number != nil\n}","tryCatchPattern":"block, err := ProposalToBlock(prop)\nif err != nil && strings.HasPrefix(err.Error(), \"bad header\") {\n    // treat proposal as corrupted: resync from quorum\n    return resync()\n}","preventionTips":["Keep all orderer binaries at the same Fabric version.","Verify checksums/backups of WAL and ledger data.","Reject proposals whose provenance cannot be established (signature checks first).","Test upgrades on a staging network to catch encoding changes."],"tags":["hyperledger-fabric","smartbft","asn1","corrupt-data"],"backgroundTag":"header-decode-failed","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"}