{"record":{"id":"92d316902efa645c","repo":"hyperledger/fabric","slug":"policy-s-at-path-s-was-nil","errorCode":null,"errorMessage":"policy %s at path %s was nil","messagePattern":"policy (.+?) at path (.+?) was nil","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/policies/policy.go","lineNumber":205,"sourceCode":"\t_, ok := providers[int32(cb.Policy_IMPLICIT_META)]\n\tif ok {\n\t\tlogger.Panicf(\"ImplicitMetaPolicy type must be provider by the policy manager\")\n\t}\n\n\tmanagers := make(map[string]*ManagerImpl)\n\n\tfor groupName, group := range root.Groups {\n\t\tmanagers[groupName], err = NewManagerImpl(path+PathSeparator+groupName, providers, group)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tpolicies := make(map[string]Policy)\n\tfor policyName, configPolicy := range root.Policies {\n\t\tpolicy := configPolicy.Policy\n\t\tif policy == nil {\n\t\t\treturn nil, fmt.Errorf(\"policy %s at path %s was nil\", policyName, path)\n\t\t}\n\n\t\tvar cPolicy Policy\n\n\t\tif policy.Type == int32(cb.Policy_IMPLICIT_META) {\n\t\t\timp, err := NewImplicitMetaPolicy(policy.Value, managers)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"implicit policy %s at path %s did not compile\", policyName, path)\n\t\t\t}\n\t\t\tcPolicy = imp\n\t\t} else {\n\t\t\tprovider, ok := providers[policy.Type]\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"policy %s at path %s has unknown policy type: %v\", policyName, path, policy.Type)\n\t\t\t}\n\n\t\t\tvar err error\n\t\t\tcPolicy, _, err = provider.NewPolicy(policy.Value)","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/policies/policy.go#L187-L223","documentation":"NewManagerImpl builds the runtime policy map from the config tree. If a configured policy entry exists but its embedded Policy proto is nil, the manager cannot construct it and throws this error naming the policy and its config path.","triggerScenarios":"Calling NewManagerImpl (directly or via NewBundle) on a config tree where root.Policies contains an entry whose Policy field was never populated, e.g. a placeholder policy group created but not assigned a policy proto.","commonSituations":"Hand-edited or tool-generated channel config with an empty policy entry; an update transaction that removed the policy body but left the key; configtx template producing an empty policy stanza.","solutions":["Populate the Policy field (type and value) for the named policy in the config","Regenerate the channel configuration with a correct configtx.yaml profile so every policy entry has a body","Remove the empty policy entry if it is not needed"],"exampleFix":"// before\n&cb.ConfigPolicy{Policy: nil}\n// after\n&cb.ConfigPolicy{Policy: &cb.Policy{Type: int32(cb.Policy_IMPLICIT_META), Value: \"ANY Readers\"}}","handlingStrategy":"validation","validationCode":"for name, cp := range configGroup.Policies {\n  if cp == nil || cp.Policy == nil {\n    return fmt.Errorf(\"policy %s has no Policy proto defined\", name)\n  }\n}","typeGuard":null,"tryCatchPattern":"mgr, err := policies.NewManagerImpl(root, path, providers)\nif err != nil && strings.Contains(err.Error(), \"was nil\") {\n  return fmt.Errorf(\"channel config contains an empty policy entry: %w\", err)\n}","preventionTips":["Never leave a Policy entry without a Type and Value in channel config","Regenerate config with configtxgen instead of hand-editing protos","Validate the config tree before submitting channel updates"],"tags":["hyperledger-fabric","channel-config","policy-config"],"backgroundTag":"nil-policy-definition","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"}