hyperledger/fabric · error
invalid block: does not have metadata
Error message
invalid block: does not have metadata
What it means
ValidateJoinBlock guard: the candidate join block has no metadata section (nil Metadata or empty metadata slice). A well-formed Fabric block always carries metadata (e.g. the last-config pointer), so this indicates a truncated or hand-crafted block.
Source
Thrown at orderer/common/channelparticipation/validator.go:33
"github.com/hyperledger/fabric/common/channelconfig"
"github.com/hyperledger/fabric/common/configtx"
"github.com/hyperledger/fabric/orderer/common/types"
"github.com/hyperledger/fabric/protoutil"
"github.com/pkg/errors"
)
// ValidateJoinBlock checks whether this block can be used as a join block for the channel participation API.
// It returns the channel ID.
// It verifies that it is not a system channel by checking that consortiums config does not exist.
// It verifies it is an application channel by checking that the application group exists.
// It returns an error when it cannot be used as a join-block.
func ValidateJoinBlock(configBlock *cb.Block) (channelID string, err error) {
if !protoutil.IsConfigBlock(configBlock) {
return "", errors.New("block is not a config block")
}
if configBlock.Metadata == nil || len(configBlock.Metadata.Metadata) == 0 {
return "", errors.New("invalid block: does not have metadata")
}
dataHash := protoutil.ComputeBlockDataHash(configBlock.Data)
if !bytes.Equal(dataHash, configBlock.Header.DataHash) {
return "", errors.New("invalid block: Header.DataHash is different from Hash(block.Data)")
}
envelope, err := protoutil.ExtractEnvelope(configBlock, 0)
if err != nil {
return "", err
}
cryptoProvider := factory.GetDefault()
bundle, err := channelconfig.NewBundleFromEnvelope(envelope, cryptoProvider)
if err != nil {
return "", err
}
View on GitHub (pinned to 2736b63f8f)
Solutions
- Re-fetch the config block from a trusted peer or orderer
- Verify the block was not truncated during transfer (checksum/size)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at orderer/common/channelparticipation/validator.go:33 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/08f08959723f0306.
Report an issue: GitHub.