hyperledger/fabric · error
malformed orderer metadata in block
Error message
malformed orderer metadata in block
What it means
verifySignatureIsBoundToProposal successfully unmarshalled the block's SIGNATURES metadata but then failed to unmarshal signatureMetadata.Value into cb.OrdererBlockMetadata. The Value bytes inside the signature metadata are corrupt or were written by a component that does not serialize OrdererBlockMetadata correctly.
Source
Thrown at orderer/consensus/smartbft/verifier.go:433
if err != nil {
v.Logger.Warnf("got malformed proposal: %v", err)
return err
}
// Ensure Metadata slice is of the right size
if len(block.Metadata.Metadata) != len(cb.BlockMetadataIndex_name) {
return errors.Errorf("block metadata is of size %d but should be of size %d",
len(block.Metadata.Metadata), len(cb.BlockMetadataIndex_name))
}
signatureMetadata := &cb.Metadata{}
if err := proto.Unmarshal(block.Metadata.Metadata[cb.BlockMetadataIndex_SIGNATURES], signatureMetadata); err != nil {
return errors.Wrap(err, "malformed signature metadata")
}
ordererMDFromBlock := &cb.OrdererBlockMetadata{}
if err := proto.Unmarshal(signatureMetadata.Value, ordererMDFromBlock); err != nil {
return errors.Wrap(err, "malformed orderer metadata in block")
}
// Ensure the block's OrdererBlockMetadata matches the signature.
if !proto.Equal(ordererMDFromBlock, ordererMD) {
return errors.Errorf("signature's OrdererBlockMetadata and OrdererBlockMetadata extracted from block do not match")
}
return nil
}
type consenterVerifier struct {
logger *flogging.FabricLogger
channel string
policyManager policies.Manager
}
// Evaluate evaluates signed data and returns no error if signature is valid and satisfies the policy
func (cv *consenterVerifier) Evaluate(signatureSet []*protoutil.SignedData) error {View on GitHub (pinned to 2736b63f8f)
Solutions
- Ensure the block originates from a SmartBFT-consensus orderer of a compatible version
- Restore the block from a peer/other orderer or from backup
- Inspect the wrapped proto error to identify the malformed field
- If testing, fix the block-building code to serialize cb.OrdererBlockMetadata into Value
Example fix
// before: hand-crafted metadata in tests
sigMeta.Value = []byte("not-a-proto")
// after
obm := &cb.OrdererBlockMetadata{ConsenterMetadata: consenterMD}
val, _ := proto.Marshal(obm)
sigMeta.Value = val Defensive patterns
Strategy: validation
Validate before calling
sigMD, err := protoutil.GetMetadataFromBlock(blk, cb.BlockMetadataIndex_SIGNATURES)
if err != nil { return err }
obm := &cb.OrdererBlockMetadata{}
if err := proto.Unmarshal(sigMD.Value, obm); err != nil {
return fmt.Errorf("invalid OrdererBlockMetadata in block %d: %w", blk.Header.Number, err)
} Type guard
func hasOrdererBlockMetadata(m *cb.Metadata) bool {
if m == nil || len(m.Value) == 0 { return false }
obm := &cb.OrdererBlockMetadata{}
return proto.Unmarshal(m.Value, obm) == nil
} Try / catch
if err := verifier.VerifyConsenterSig(blk, sig); err != nil {
if strings.Contains(err.Error(), "malformed orderer metadata in block") {
log.Warnf("rejecting block %d: %v", blk.Header.Number, err)
return errRejectBlock
}
return err
} Prevention
- Only accept blocks from SmartBFT orderers writing OrdererBlockMetadata
- Serialize all metadata with proto.Marshal in custom tooling/tests
- Pin consistent Fabric versions across the ordering service
- Validate block contents with protoutil helpers before consensus verification
When it happens
Trigger: VerifyConsenterSig called on a block where the unmarshalled cb.Metadata.Value field is not a valid serialized cb.OrdererBlockMetadata message.
Common situations: Blocks produced by older Fabric consensus (e.g. etcdraft-style metadata) fed into a SmartBFT channel; corrupted block store; custom block producers/test harnesses writing wrong Value bytes.
Understand the failure class
Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- malformed signature metadata
- failed to unmarshal orderer block metadata
- failed to unmarshal BFT metadata configuration
- failed to marshal request envelope: proto: Marshal called wi
- failed to marshal request envelope
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/2e28bb659a45bc20.
Report an issue: GitHub.