{"record":{"id":"b59150d69bed6126","repo":"hyperledger/fabric","slug":"config-block-channel-id-s-does-not-match-expect","errorCode":null,"errorMessage":"config block channel ID [%s] does not match expected: [%s]","messagePattern":"config block channel ID \\[(.+?)\\] does not match expected: \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/deliverclient/block_verification.go","lineNumber":221,"sourceCode":"\t\treturn errors.WithMessage(err, \"error extracting envelope\")\n\t}\n\n\tpayload, err := protoutil.UnmarshalPayload(configTx.Payload)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"error unmarshalling envelope to payload\")\n\t}\n\n\tif payload.Header == nil {\n\t\treturn errors.New(\"missing channel header\")\n\t}\n\n\tchdr, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"error unmarshalling channel header\")\n\t}\n\n\tif chdr.GetChannelId() != a.channelID {\n\t\treturn errors.Errorf(\"config block channel ID [%s] does not match expected: [%s]\", chdr.GetChannelId(), a.channelID)\n\t}\n\n\tconfigEnvelope, err := configtx.UnmarshalConfigEnvelope(payload.Data)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"error unmarshalling config envelope from payload data\")\n\t}\n\n\tverifierFunc, err := a.verifierAssembler.VerifierFromConfig(configEnvelope, chdr.GetChannelId())\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"error creating verifier function\")\n\t}\n\n\ta.configBlockHeader = configBlock.Header\n\ta.lastBlockHeader = configBlock.Header\n\ta.lastBlockHeaderHash = protoutil.BlockHeaderHash(configBlock.Header)\n\ta.sigVerifierFunc = verifierFunc\n\n\treturn nil","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/deliverclient/block_verification.go#L203-L239","documentation":"UpdateConfig validates that the config block belongs to the channel the verification assistant was constructed for. If the ChannelHeader's channel ID differs from a.channelID, the config block cannot be applied to this channel's verifier and the mismatch is reported with both values.","triggerScenarios":"Delivering/subscribing blocks for a different channel than the one the assistant was created with; the deliver client was constructed with the wrong channelID; a seek on the wrong channel config stream; tests reusing a client across channels.","commonSituations":"Multi-channel deployments where channel IDs are mixed up (case-sensitive, typo, ordering-system vs application channel name); copying client setup code for another channel without updating the ID.","solutions":["Construct the deliver client / verification assistant with the correct channel ID matching the ledger being delivered.","Check the delivered block's chdr.ChannelId (e.g. protoutil.GetChannelIDFromBlock) and route it to a matching assistant.","Fix typos/case mismatches in channel configuration."],"exampleFix":"// before\nclient, _ := NewDeliverClient(\"orderer:7050\", \"mychannel\", ...) // typo'd id\n\n// after\nblockChannel := protoutil.GetChannelIDFromBlock(configBlock)\nclient, _ := NewDeliverClient(\"orderer:7050\", blockChannel, ...)","handlingStrategy":"validation","validationCode":"blockChannelID, err := protoutil.GetChannelIDFromBlock(configBlock)\nif err != nil { return err }\nif blockChannelID != expectedChannelID {\n    return fmt.Errorf(\"block is for channel %s, not %s\", blockChannelID, expectedChannelID)\n}","typeGuard":"func matchesChannel(block *common.Block, want string) bool {\n    got, err := protoutil.GetChannelIDFromBlock(block)\n    return err == nil && got == want\n}","tryCatchPattern":"if err := bva.UpdateConfig(env); err != nil {\n    if strings.Contains(err.Error(), \"does not match expected\") {\n        // recreate assistant with the block's actual channel ID\n    }\n    return err\n}","preventionTips":["Copy channel IDs from configuration, not by hand-editing literals","Route blocks to verification assistants keyed by chdr.ChannelId","Remember channel IDs are case-sensitive; validate against the network config"],"tags":["hyperledger-fabric","deliver-client","channel-mismatch"],"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"}