hyperledger/fabric · error
failed to unmarshal block's metadata
Error message
failed to unmarshal block's metadata
What it means
ReadBlockMetadata wraps a proto.Unmarshal failure on the block's metadata value: the persisted block metadata (RAFT metadata in metadata slot) exists but is not a decodable etcdraft.BlockMetadata protobuf — corrupt or written by an incompatible version.
Source
Thrown at orderer/consensus/etcdraft/consenter.go:281
}
if _, err := c.detectSelfID(consenters); err != nil {
if err != cluster.ErrNotInChannel {
return false, errors.Wrapf(err, "failed to detect self ID by comparing public keys")
}
return false, nil
}
return true, nil
}
// ReadBlockMetadata attempts to read raft metadata from block metadata, if available.
// otherwise, it reads raft metadata from config metadata supplied.
func ReadBlockMetadata(blockMetadata *common.Metadata, configMetadata *etcdraft.ConfigMetadata) (*etcdraft.BlockMetadata, error) {
if blockMetadata != nil && len(blockMetadata.GetValue()) != 0 { // we have consenters mapping from block
m := &etcdraft.BlockMetadata{}
if err := proto.Unmarshal(blockMetadata.GetValue(), m); err != nil {
return nil, errors.Wrap(err, "failed to unmarshal block's metadata")
}
return m, nil
}
m := &etcdraft.BlockMetadata{
NextConsenterId: 1,
ConsenterIds: make([]uint64, len(configMetadata.GetConsenters())),
}
// need to read consenters from the configuration
for i := range m.GetConsenterIds() {
m.ConsenterIds[i] = m.GetNextConsenterId()
m.NextConsenterId++
}
return m, nil
}
// New creates a etcdraft ConsenterView on GitHub (pinned to 2736b63f8f)
Solutions
- Restore the ledger/WAL from a healthy backup
- Check for version skew if blocks were written by a different Fabric release
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at orderer/consensus/etcdraft/consenter.go:281 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/74556740f8d8fffd.
Report an issue: GitHub.