{"record":{"id":"21a38643054a3873","repo":"hyperledger/fabric","slug":"failed-obtaining-channel-application-writers-polic","errorCode":null,"errorMessage":"failed obtaining channel application writers policy","messagePattern":"failed obtaining channel application writers policy","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"discovery/support/acl/support.go","lineNumber":138,"sourceCode":"\n// ChannelVerifier verifies a signature and a message on the context of a channel\ntype ChannelVerifier struct {\n\tpolicies.ChannelPolicyManagerGetter\n\tPolicy string\n}\n\n// VerifyByChannel checks that signature is a valid signature of message\n// under a peer's verification key, but also in the context of a specific channel.\n// If the verification succeeded, Verify returns nil meaning no error occurred.\n// If peerIdentity is nil, then the verification fails.\nfunc (cv *ChannelVerifier) VerifyByChannel(channel string, sd *protoutil.SignedData) error {\n\tmgr := cv.Manager(channel)\n\tif mgr == nil {\n\t\treturn errors.Errorf(\"policy manager for channel %s doesn't exist\", channel)\n\t}\n\tpol, _ := mgr.GetPolicy(cv.Policy)\n\tif pol == nil {\n\t\treturn errors.New(\"failed obtaining channel application writers policy\")\n\t}\n\treturn pol.EvaluateSignedData([]*protoutil.SignedData{sd})\n}\n","sourceCodeStart":120,"sourceCodeEnd":142,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/discovery/support/acl/support.go#L120-L142","documentation":"The channel's policy manager exists but could not return the Application writers policy that ChannelVerifier is configured with (cv.Policy, defaulting to the channel's /Channel/Application/Writers path). Evaluating the signed data requires this policy; if GetPolicy returns nil the request cannot be authorized.","triggerScenarios":"mgr.GetPolicy(cv.Policy) returns nil because the channel config lacks an Application/Writers policy (non-standard channel config) or the verifier's configured policy string doesn't exist in the channel's policy tree.","commonSituations":"Channels created with a modified configtx.yaml that renames or omits the Application.Writers policy; custom discovery deployments configuring a different policy path that doesn't exist on the channel.","solutions":["Ensure the channel config defines the standard Application policies (Readers/Writers/Admins) via configtxgen","Verify the ChannelVerifier's Policy field matches an actual policy path in the channel config","Regenerate and update channel config from the default configtx.yaml template"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// verify channel config includes Application policies\n// e.g. inspect configtx.yaml / fetched channel config for /Channel/Application/Writers","typeGuard":null,"tryCatchPattern":"res, err := client.Send(ctx, req)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed obtaining channel application writers policy\") {\n        // fall back to non-channel-scoped discovery or re-verify config\n    }\n    return err\n}","preventionTips":["Generate channels with the default Application policies (Readers/Writers/Admins)","Keep the discovery verifier's policy path in sync with the channel config","Review custom configtx.yaml changes before channel creation"],"tags":["fabric","policy","discovery","authorization"],"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"}