{"record":{"id":"08f08959723f0306","repo":"hyperledger/fabric","slug":"invalid-block-does-not-have-metadata","errorCode":null,"errorMessage":"invalid block: does not have metadata","messagePattern":"invalid block: does not have metadata","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/channelparticipation/validator.go","lineNumber":33,"sourceCode":"\t\"github.com/hyperledger/fabric/common/channelconfig\"\n\t\"github.com/hyperledger/fabric/common/configtx\"\n\t\"github.com/hyperledger/fabric/orderer/common/types\"\n\t\"github.com/hyperledger/fabric/protoutil\"\n\t\"github.com/pkg/errors\"\n)\n\n// ValidateJoinBlock checks whether this block can be used as a join block for the channel participation API.\n// It returns the channel ID.\n// It verifies that it is not a system channel by checking that consortiums config does not exist.\n// It verifies it is an application channel by checking that the application group exists.\n// It returns an error when it cannot be used as a join-block.\nfunc ValidateJoinBlock(configBlock *cb.Block) (channelID string, err error) {\n\tif !protoutil.IsConfigBlock(configBlock) {\n\t\treturn \"\", errors.New(\"block is not a config block\")\n\t}\n\n\tif configBlock.Metadata == nil || len(configBlock.Metadata.Metadata) == 0 {\n\t\treturn \"\", errors.New(\"invalid block: does not have metadata\")\n\t}\n\n\tdataHash := protoutil.ComputeBlockDataHash(configBlock.Data)\n\tif !bytes.Equal(dataHash, configBlock.Header.DataHash) {\n\t\treturn \"\", errors.New(\"invalid block: Header.DataHash is different from Hash(block.Data)\")\n\t}\n\n\tenvelope, err := protoutil.ExtractEnvelope(configBlock, 0)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcryptoProvider := factory.GetDefault()\n\tbundle, err := channelconfig.NewBundleFromEnvelope(envelope, cryptoProvider)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/channelparticipation/validator.go#L15-L51","documentation":"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.","triggerScenarios":"Thrown at orderer/common/channelparticipation/validator.go:33 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-fetch the config block from a trusted peer or orderer","Verify the block was not truncated during transfer (checksum/size)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}