{"record":{"id":"794078742b2a751d","repo":"hyperledger/fabric","slug":"field-config-channelgroup-values-is-nil","errorCode":null,"errorMessage":"field Config.ChannelGroup.Values is nil","messagePattern":"field Config\\.ChannelGroup\\.Values is nil","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"discovery/support/config/support.go","lineNumber":246,"sourceCode":"func ValidateConfig(c *common.Config) error {\n\tif c.ChannelGroup == nil {\n\t\treturn errors.New(\"field Config.ChannelGroup is nil\")\n\t}\n\tgrps := c.ChannelGroup.Groups\n\tif grps == nil {\n\t\treturn errors.New(\"field Config.ChannelGroup.Groups is nil\")\n\t}\n\tfor _, field := range []string{channelconfig.OrdererGroupKey, channelconfig.ApplicationGroupKey} {\n\t\tgrp, exists := grps[field]\n\t\tif !exists {\n\t\t\treturn fmt.Errorf(\"key Config.ChannelGroup.Groups[%s] is missing\", field)\n\t\t}\n\t\tif grp.Groups == nil {\n\t\t\treturn fmt.Errorf(\"key Config.ChannelGroup.Groups[%s].Groups is nil\", field)\n\t\t}\n\t}\n\tif c.ChannelGroup.Values == nil {\n\t\treturn errors.New(\"field Config.ChannelGroup.Values is nil\")\n\t}\n\treturn nil\n}\n","sourceCodeStart":228,"sourceCodeEnd":250,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/discovery/support/config/support.go#L228-L250","documentation":"Also from discovery service ValidateConfig: after checking the Orderer/Application groups, it requires Config.ChannelGroup.Values to be non-nil. The root channel group must carry values (e.g. HashingAlgorithm, BlockDataHashingStructure, OrdererAddresses); a nil Values map means the config lacks the mandatory channel-level parameters discovery needs.","triggerScenarios":"ValidateConfig receives a Config whose ChannelGroup exists and has Groups but with Values == nil — typically a hand-assembled Config, a config built before channel values were attached, or deserialization of an incomplete config.","commonSituations":"Writing custom tools that patch channel configs; tests that stub common.Config with only Groups populated; feeding an empty or partial config block into discovery support initialization.","solutions":["Generate the channel config with configtxgen so ChannelGroup.Values contains the standard channel values","When building Config manually, populate ChannelGroup.Values (at minimum HashingAlgorithm, BlockDataHashingStructure, ChannelRestrictions, OrdererAddresses)","Inspect the config with configtxlator decode to confirm ChannelGroup.Values is present before passing it to discovery"],"exampleFix":"// before\ncfg.ChannelGroup = &common.ConfigGroup{Groups: map[string]*common.ConfigGroup{...}}\n\n// after\ncfg.ChannelGroup = &common.ConfigGroup{\n    Groups: map[string]*common.ConfigGroup{...},\n    Values: map[string]*common.ConfigValue{\n        \"HashingAlgorithm\": {...},\n        \"BlockDataHashingStructure\": {...},\n    },\n}","handlingStrategy":"validation","validationCode":"func hasChannelValues(cfg *common.Config) bool {\n    return cfg != nil && cfg.ChannelGroup != nil && cfg.ChannelGroup.Values != nil\n}\n// if !hasChannelValues(cfg) { repopulate values before ValidateConfig }","typeGuard":"if cfg != nil && cfg.ChannelGroup != nil && cfg.ChannelGroup.Values != nil { /* safe */ }","tryCatchPattern":null,"preventionTips":["Never strip ChannelGroup.Values when patching configs programmatically","Keep channel-level values (HashingAlgorithm etc.) in every generated config","Validate configs with configtxlator before handing them to discovery"],"tags":["hyperledger-fabric","config-validation","protobuf","discovery"],"backgroundTag":"invalid-channel-config","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"}