{"record":{"id":"1a346d86eb35813e","repo":"hyperledger/fabric","slug":"specified-channelid-s-does-not-match-channel-id","errorCode":null,"errorMessage":"specified --channelID %s does not match channel ID %s in config block","messagePattern":"specified --channelID (.+?) does not match channel ID (.+?) in config block","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/osnadmin/main.go","lineNumber":225,"sourceCode":"\treturn fmt.Sprintf(\"Error: %s\\n\", err)\n}\n\nfunc validateBlockChannelID(blockBytes []byte, channelID string) error {\n\tblock := &common.Block{}\n\terr := proto.Unmarshal(blockBytes, block)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling block: %s\", err)\n\t}\n\n\tblockChannelID, err := protoutil.GetChannelIDFromBlock(block)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// quick sanity check that the orderer admin is joining\n\t// the channel they think they're joining.\n\tif channelID != blockChannelID {\n\t\treturn fmt.Errorf(\"specified --channelID %s does not match channel ID %s in config block\", channelID, blockChannelID)\n\t}\n\n\treturn nil\n}\n\nfunc validateEnvelopeChannelID(envelopeBytes []byte, channelID string) error {\n\tenvelope := &common.Envelope{}\n\terr := proto.Unmarshal(envelopeBytes, envelope)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling envelope: %s\", err)\n\t}\n\n\tenvelopeChannelID, err := protoutil.GetChannelIDFromEnvelope(envelope)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// quick sanity check that the orderer admin is joining","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/cmd/osnadmin/main.go#L207-L243","documentation":"A sanity check in validateBlockChannelID: the channel ID inside the parsed config block must equal the --channelID flag. This error stops you from joining an orderer to a channel whose block belongs to a different channel.","triggerScenarios":"`osnadmin channel join --channelID A --configBlock <block for channel B>`.","commonSituations":"Copy-pasting the wrong block file, reusing a block from a prior channel, or typo in the --channelID flag (channel IDs are case-sensitive).","solutions":["Pass the correct --channelID matching the block's channel.","Re-fetch the config block for the intended channel.","Regenerate the block with configtxgen for the target channel.","Check for case-sensitivity or trailing whitespace in --channelID."],"exampleFix":"// before\nosnadmin channel join --channelID mychannel --configBlock otherchannel.block\n// after\nosnadmin channel join --channelID otherchannel --configBlock otherchannel.block","handlingStrategy":"validation","validationCode":"// extract channel ID from block before joining\nblock := &common.Block{}\nif err := proto.Unmarshal(blockBytes, block); err != nil { return err }\nblockCh, err := protoutil.GetChannelIDFromBlock(block)\nif err != nil { return err }\nif blockCh != targetChannelID {\n    return fmt.Errorf(\"block is for %s, want %s\", blockCh, targetChannelID)\n}","typeGuard":null,"tryCatchPattern":"if err := runOsnadmin(); err != nil {\n    if strings.Contains(err.Error(), \"does not match channel ID\") {\n        log.Fatalf(\"--channelID disagrees with block contents: %v\", err)\n    }\n}","preventionTips":["Name block files after their channel (mychannel.block).","Copy --channelID from the same config used to generate the block.","Remember channel IDs are case-sensitive.","Re-fetch the block if the channel was recreated."],"tags":["validation","channel","hyperledger-fabric"],"backgroundTag":"channel-id-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"}