{"record":{"id":"3585c260eded6f7f","repo":"hyperledger/fabric","slug":"configpolicy-not-found-at-policy-path-s","errorCode":null,"errorMessage":"ConfigPolicy not found at policy path: %s","messagePattern":"ConfigPolicy not found at policy path: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/configtx/configmap.go","lineNumber":153,"sourceCode":"\t\tvaluePath := valuePrefix + path + pathSeparator + key\n\t\tvalue, ok := configMap[valuePath]\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"missing value at path: %s\", valuePath)\n\t\t}\n\t\tif value.ConfigValue == nil {\n\t\t\treturn nil, errors.Errorf(\"ConfigValue not found at value path: %s\", valuePath)\n\t\t}\n\t\tnewConfigGroup.Values[key] = proto.Clone(value.ConfigValue).(*cb.ConfigValue)\n\t}\n\n\tfor key := range group.Policies {\n\t\tpolicyPath := policyPrefix + path + pathSeparator + key\n\t\tpolicy, ok := configMap[policyPath]\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"missing policy at path: %s\", policyPath)\n\t\t}\n\t\tif policy.ConfigPolicy == nil {\n\t\t\treturn nil, errors.Errorf(\"ConfigPolicy not found at policy path: %s\", policyPath)\n\t\t}\n\t\tnewConfigGroup.Policies[key] = proto.Clone(policy.ConfigPolicy).(*cb.ConfigPolicy)\n\t\tlogger.Debugf(\"Setting policy for key %s to %+v\", key, group.Policies[key])\n\t}\n\n\t// This is a really very hacky fix to facilitate upgrading channels which were constructed\n\t// using the channel generation from v1.0 with bugs FAB-5309, and FAB-6080.\n\t// In summary, these channels were constructed with a bug which left mod_policy unset in some cases.\n\t// If mod_policy is unset, it's impossible to modify the element, and current code disallows\n\t// unset mod_policy values.  This hack 'fixes' existing config with empty mod_policy values.\n\t// If the capabilities framework is on, it sets any unset mod_policy to 'Admins'.\n\t// This code needs to sit here until validation of v1.0 channels is deprecated from the codebase.\n\tif _, ok := configMap[hackyFixOrdererCapabilities]; ok {\n\t\t// Hacky fix constants, used in recurseConfigMap\n\t\tif newConfigGroup.ModPolicy == \"\" {\n\t\t\tlogger.Debugf(\"Performing upgrade of group %s empty mod_policy\", groupPath)\n\t\t\tnewConfigGroup.ModPolicy = hackyFixNewModPolicy\n\t\t}","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/configtx/configmap.go#L135-L171","documentation":"The config map contained an entry at the policy path, but its ConfigPolicy field was nil. recurseConfigMap requires the map value to be a Config entry carrying a ConfigPolicy to clone into the new group.","triggerScenarios":"The configMap entry at '<policyPrefix><groupPath>/<key>' exists but is a ConfigGroup or ConfigValue entry rather than a ConfigPolicy, so policy.ConfigPolicy is nil.","commonSituations":"Prefix mismatch when building the map (e.g. policy stored under valuePrefix or groupPrefix), causing a non-policy entry to be found at the policy path.","solutions":["Verify the map entry at the policy path is a *cb.Config with a non-nil ConfigPolicy field.","Check the policyPrefix used when inserting entries matches the policyPrefix used during lookup.","Reconstruct the map using the library's own mapPopulation helpers rather than custom path strings."],"exampleFix":"// before\nconfigMap[\"/Channel/policies/Admins\"] = &Config{ConfigGroup: group} // wrong type\n// after\nconfigMap[\"/Channel/policies/Admins\"] = &Config{ConfigPolicy: policy.ConfigPolicy}","handlingStrategy":"validation","validationCode":"p := configMap[policyPath]\nif p == nil || p.ConfigPolicy == nil {\n  return fmt.Errorf(\"entry at %s is not a ConfigPolicy\", policyPath)\n}","typeGuard":"func isConfigPolicy(c interface{}) bool { cfg, ok := c.(*cb.Config); return ok && cfg != nil && cfg.ConfigPolicy != nil }","tryCatchPattern":"defer func() {\n  if r := recover(); r != nil { /* handle nil-clone panic */ }\n}()\n// or on error: log policyPath entry type and fail fast","preventionTips":["Store each entry under the correct prefix (policy vs value vs group)","Nil-check ConfigPolicy before inserting into the map","Unit-test map construction against the canonical path scheme"],"tags":["hyperledger-fabric","configtx","policy"],"backgroundTag":"missing-policy-path","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"}