{"record":{"id":"bb114ae314a87850","repo":"hyperledger/fabric","slug":"no-such-policy-bb114a","errorCode":null,"errorMessage":"No such policy","messagePattern":"No such policy","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/cauthdsl/policy.go","lineNumber":100,"sourceCode":"\n// EvaluateSignedData takes a set of SignedData and evaluates whether\n// 1) the signatures are valid over the related message\n// 2) the signing identities satisfy the policy\nfunc (p *policy) EvaluateSignedData(signatureSet []*protoutil.SignedData) error {\n\tif p == nil {\n\t\treturn errors.New(\"no such policy\")\n\t}\n\n\tids := policies.SignatureSetToValidIdentities(signatureSet, p.deserializer)\n\n\treturn p.EvaluateIdentities(ids)\n}\n\n// EvaluateIdentities takes an array of identities and evaluates whether\n// they satisfy the policy\nfunc (p *policy) EvaluateIdentities(identities []msp.Identity) error {\n\tif p == nil {\n\t\treturn fmt.Errorf(\"No such policy\")\n\t}\n\n\tok := p.evaluator(identities, make([]bool, len(identities)))\n\tif !ok {\n\t\treturn errors.New(\"signature set did not satisfy policy\")\n\t}\n\treturn nil\n}\n\nfunc (p *policy) Convert() (*cb.SignaturePolicyEnvelope, error) {\n\tif p.signaturePolicyEnvelope == nil {\n\t\treturn nil, errors.New(\"nil policy field\")\n\t}\n\n\treturn p.signaturePolicyEnvelope, nil\n}\n","sourceCodeStart":82,"sourceCodeEnd":117,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/cauthdsl/policy.go#L82-L117","documentation":"EvaluateIdentities has the same nil-receiver guard as EvaluateSignedData: evaluating identities through a nil *policy means the policy object was never constructed, and the caller gets 'No such policy'.","triggerScenarios":"Calling EvaluateIdentities on a nil *policy — the result of a failed/absent policy resolution — instead of a compiled policy.","commonSituations":"Same as error 75: missing channel policy definitions, mistyped policy IDs, or code paths that ignore construction errors and keep a nil policy handle.","solutions":["Guard the policy pointer for nil before evaluation","Correct the policy lookup/construction so a valid *policy is obtained","Define the missing policy in channel configuration"],"exampleFix":"// before\nvar p *policy\nerr := p.EvaluateIdentities(ids)\n// after\nif p == nil {\n    return errors.New(\"no policy configured\")\n}\nerr := p.EvaluateIdentities(ids)","handlingStrategy":"type-guard","validationCode":"if p == nil {\n    return errors.New(\"cannot evaluate: policy object is nil\")\n}","typeGuard":"func isEvaluatable(p *policy) bool { return p != nil && p.evaluator != nil }","tryCatchPattern":"err := pol.EvaluateIdentities(ids)\nif err != nil && err.Error() == \"No such policy\" {\n    return errors.New(\"policy handle is nil; re-resolve from the policy manager\")\n}","preventionTips":["Propagate policy-construction errors instead of retaining a nil handle","Centralize policy lookup so nil results are rejected once","Add nil checks at every call site rather than relying on the library guard"],"tags":["policy","nil-pointer","not-found"],"backgroundTag":"policy-not-found","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"}