{"record":{"id":"79ee5fb0d716c9c7","repo":"hyperledger/fabric","slug":"could-not-find-policy-s-79ee5f","errorCode":null,"errorMessage":"could not find policy %s","messagePattern":"could not find policy (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/consensus/smartbft/verifier.go","lineNumber":455,"sourceCode":"\tif !proto.Equal(ordererMDFromBlock, ordererMD) {\n\t\treturn errors.Errorf(\"signature's OrdererBlockMetadata and OrdererBlockMetadata extracted from block do not match\")\n\t}\n\n\treturn nil\n}\n\ntype consenterVerifier struct {\n\tlogger        *flogging.FabricLogger\n\tchannel       string\n\tpolicyManager policies.Manager\n}\n\n// Evaluate evaluates signed data and returns no error if signature is valid and satisfies the policy\nfunc (cv *consenterVerifier) Evaluate(signatureSet []*protoutil.SignedData) error {\n\tpolicy, ok := cv.policyManager.GetPolicy(policies.ChannelOrdererWriters)\n\tif !ok {\n\t\tcv.logger.Errorf(\"[%s] Error: could not find policy %s in policy manager %v\", cv.channel, policies.ChannelOrdererWriters, cv.policyManager)\n\t\treturn errors.Errorf(\"could not find policy %s\", policies.ChannelOrdererWriters)\n\t}\n\n\tif cv.logger.IsEnabledFor(zapcore.DebugLevel) {\n\t\tcv.logger.Debugf(\"== Evaluating %T Policy %s ==\", policy, policies.ChannelOrdererWriters)\n\t\tdefer cv.logger.Debugf(\"== Done Evaluating %T Policy %s\", policy, policies.ChannelOrdererWriters)\n\t}\n\n\treturn policy.EvaluateSignedData(signatureSet)\n}\n","sourceCodeStart":437,"sourceCodeEnd":465,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/consensus/smartbft/verifier.go#L437-L465","documentation":"consenterVerifier.Evaluate looks up the '/Channel/Orderer/Writers' policy via the channel's policy manager and returns this error when the policy is not registered. Without the Writers policy the verifier cannot authenticate that the signature came from an authorized orderer writer.","triggerScenarios":"Evaluate (called during VerifyConsenterSig signature-set evaluation) runs against a policyManager that does not contain policies.ChannelOrdererWriters — typically an uninitialized, stale, or wrong-channel policy manager.","commonSituations":"Channel config missing or mis-formed Orderer/Writers policy; verifier created before channel config was loaded; chaincode/system code wiring the wrong policy manager; config update removed the policy.","solutions":["Verify the channel's config contains a valid Orderer/Writers policy (check the channel config transaction)","Ensure the verifier is constructed with the policy manager for the correct, fully-initialized channel","Restore a known-good channel config (latest config block) if a bad update removed the policy","Enable orderer debug logs to inspect which policy manager was passed to consenterVerifier"],"exampleFix":"// before: verifier built with an empty/in-progress manager\nverifier := newVerifier(pm, ...) // pm has no policies yet\n// after: wait for channel config load and check first\npolicy, ok := pm.GetPolicy(policies.ChannelOrdererWriters)\nif !ok {\n    return fmt.Errorf(\"writers policy missing from channel %s\", chID)\n}","handlingStrategy":"validation","validationCode":"pm := verifierPolicyManager(channelID)\npolicy, ok := pm.GetPolicy(policies.ChannelOrdererWriters)\nif !ok {\n    return fmt.Errorf(\"channel %s is missing %s policy; check channel config\", channelID, policies.ChannelOrdererWriters)\n}","typeGuard":"func hasWritersPolicy(pm policies.PolicyManager) bool {\n    _, ok := pm.GetPolicy(policies.ChannelOrdererWriters)\n    return ok\n}","tryCatchPattern":"if err := cv.Evaluate(signatureSet); err != nil {\n    if strings.Contains(err.Error(), \"could not find policy\") {\n        log.Errorf(\"writers policy missing; reloading channel config for %s\", cv.channel)\n        return reloadChannelConfig(cv.channel)\n    }\n    return err\n}","preventionTips":["Always include a Writers policy in channel/orderer config transactions","Construct verifiers only after channel config is fully loaded","Validate config updates before committing so policies are not dropped","Log policy manager contents at debug level when wiring consensus components"],"tags":["smartbft","policies","orderer","channel-config"],"backgroundTag":"missing-policy","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"}