{"record":{"id":"6f2127c8a7e4696a","repo":"hyperledger/fabric","slug":"failed-to-verify-transactions-are-well-formed-for","errorCode":null,"errorMessage":"failed to verify transactions are well formed for block with id [%d] on channel [%s]","messagePattern":"failed to verify transactions are well formed for block with id \\[(.+?)\\] on channel \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/deliverclient/block_verification.go","lineNumber":254,"sourceCode":"\ta.lastBlockHeaderHash = protoutil.BlockHeaderHash(configBlock.Header)\n\ta.sigVerifierFunc = verifierFunc\n\n\treturn nil\n}\n\n// VerifyBlock checks block integrity and its relation to the chain, and verifies the signatures.\nfunc (a *BlockVerificationAssistant) VerifyBlock(block *common.Block) error {\n\tif err := a.verifyHeader(block); err != nil {\n\t\treturn err\n\t}\n\n\tif err := a.verifyMetadata(block); err != nil {\n\t\treturn err\n\t}\n\n\tdataHash, err := protoutil.BlockDataHash(block.Data)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to verify transactions are well formed for block with id [%d] on channel [%s]\", block.Header.Number, a.channelID)\n\t}\n\n\t// Verify that Header.DataHash is equal to the hash of block.Data\n\t// This is to ensure that the header is consistent with the data carried by this block\n\tif !bytes.Equal(dataHash, block.Header.DataHash) {\n\t\treturn errors.Errorf(\"Header.DataHash is different from Hash(block.Data) for block with id [%d] on channel [%s]; Header: %s, Data: %s\",\n\t\t\tblock.Header.Number, a.channelID, hex.EncodeToString(block.Header.DataHash), hex.EncodeToString(dataHash))\n\t}\n\n\terr = a.sigVerifierFunc(block.Header, block.Metadata)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ta.lastBlockHeader = block.Header\n\ta.lastBlockHeaderHash = protoutil.BlockHeaderHash(block.Header)\n\n\treturn nil","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/deliverclient/block_verification.go#L236-L272","documentation":"VerifyBlock computes the hash of block.Data (via protoutil.BlockDataHash) to confirm every transaction is well formed and the data hash matches the block header. If hashing fails (malformed transaction payload inside the data), the error is wrapped with this message naming the block number and channel.","triggerScenarios":"A delivered block contains transactions that cannot be unmarshalled/validated during BlockDataHash computation — corrupted block data, non-Envelope entries in block.Data, or truncation during block transfer/storage.","commonSituations":"Peer/orderer version skew producing incompatible payloads; corrupted block files in filesystem storage; malicious or buggy custom orderer emitting malformed blocks; delivering raw blocks from unreliable sources.","solutions":["Re-fetch the block from a healthy orderer/peer (this block is corrupt and cannot be repaired).","Verify storage integrity (checksum ledger files, check disk health) if the block came from local persistence.","Check component version compatibility between orderers and peers; upgrade mismatched fabric versions.","Log the wrapped inner error to identify which transaction/payload failed to hash."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"for _, d := range block.Data.Data {\n    if _, err := protoutil.UnmarshalEnvelope(d); err != nil {\n        return fmt.Errorf(\"block contains malformed envelope at data index; refetch block\")\n    }\n}","typeGuard":"func hasDecodableData(block *common.Block) bool {\n    if block == nil || block.Data == nil { return false }\n    for _, d := range block.Data.Data {\n        if _, err := protoutil.UnmarshalEnvelope(d); err != nil { return false }\n    }\n    return true\n}","tryCatchPattern":"if err := bva.VerifyBlock(block, opts); err != nil {\n    if strings.Contains(err.Error(), \"failed to verify transactions are well formed\") {\n        block, err = refetchBlock(block.Header.Number) // corrupt copy\n    }\n    return err\n}","preventionTips":["Re-fetch suspect blocks from a healthy orderer instead of retrying verification","Monitor disk/filesystem health for ledger storage","Keep fabric versions aligned across orderers and peers"],"tags":["hyperledger-fabric","block-verification","corrupt-block"],"backgroundTag":"block-hash-mismatch","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"}