{"record":{"id":"059ed5a701901d16","repo":"hyperledger/fabric","slug":"no-such-policy","errorCode":null,"errorMessage":"no such policy","messagePattern":"no such policy","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/cauthdsl/policy.go","lineNumber":88,"sourceCode":"\treturn &policy{\n\t\tevaluator:               compiled,\n\t\tdeserializer:            pp.Deserializer,\n\t\tsignaturePolicyEnvelope: sigPolicy,\n\t}, nil\n}\n\ntype policy struct {\n\tsignaturePolicyEnvelope *cb.SignaturePolicyEnvelope\n\tevaluator               func([]msp.Identity, []bool) bool\n\tdeserializer            msp.IdentityDeserializer\n}\n\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}","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/cauthdsl/policy.go#L70-L106","documentation":"Sentinel 'no such policy' returned when policy evaluation cannot resolve a referenced policy — used by callers (and tests) to detect a missing/unregistered policy path during signature set verification and config delta validation.","triggerScenarios":"Obtaining a policy from a PolicyManager (e.g. manager.GetPolicy(id) returning nil) and then calling EvaluateSignedData on the nil result, as in TestRejectOnUnknown.","commonSituations":"Requesting a policy path/ID that was never defined in channel config (typo or missing configtx policy); checking endorsement before the policy manager finished initialization.","solutions":["Check manager.GetPolicy(...) for nil before evaluating, and surface a clear 'policy not found' error to the caller","Define the referenced policy (e.g. Readers/Writers/Admins) in the channel configuration","Verify the policy ID/path string matches what was registered"],"exampleFix":"// before\np, _ := mgr.GetPolicy(\"/Channel/Writers\")\nerr := p.EvaluateSignedData(sd) // nil policy\n// after\np, ok := mgr.GetPolicy(\"/Channel/Writers\")\nif p == nil {\n    return errors.New(\"policy /Channel/Writers not defined\")\n}\nerr := p.EvaluateSignedData(sd)","handlingStrategy":"type-guard","validationCode":"p := mgr.GetPolicy(policyID)\nif p == nil {\n    return fmt.Errorf(\"policy %q not defined in channel config\", policyID)\n}","typeGuard":"func policyExists(mgr policies.PolicyManager, id string) bool { return mgr.GetPolicy(id) != nil }","tryCatchPattern":"err := pol.EvaluateSignedData(sigSet)\nif err != nil && err.Error() == \"no such policy\" {\n    return fmt.Errorf(\"policy %q missing from channel configuration\", id)\n}","preventionTips":["Check GetPolicy results for nil before evaluating","Define Readers/Writers/Admins and lifecycle policies in every configtx","Test policy resolution in CI against the actual channel config"],"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"}