{"record":{"id":"f860db091e552bbc","repo":"hyperledger/fabric","slug":"invalid-policy-name-during-check-policy-on-signed","errorCode":null,"errorMessage":"Invalid policy name during check policy on signed data on channel [%s]. Name must be different from nil.","messagePattern":"Invalid policy name during check policy on signed data on channel \\[(.+?)\\]\\. Name must be different from nil\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/policy/policy.go","lineNumber":163,"sourceCode":"\terr = id.SatisfiesPrincipal(principal)\n\tif err != nil {\n\t\tlogger.Warnw(\"Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy\", \"error\", err, \"policyName\", policyName, \"requiredPrincipal\", principal, \"signingIdentity\", protoutil.LogMessageForSerializedIdentity(shdr.Creator))\n\t\treturn fmt.Errorf(\"Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [%s]: [%s]\", policyName, err)\n\t}\n\n\t// Verify the signature\n\treturn id.Verify(signedProp.ProposalBytes, signedProp.Signature)\n}\n\n// CheckPolicyBySignedData checks that the passed signed data is valid with the respect to\n// passed policy on the passed channel.\nfunc (p *policyChecker) CheckPolicyBySignedData(channelID, policyName string, sd []*protoutil.SignedData) error {\n\tif channelID == \"\" {\n\t\treturn errors.New(\"Invalid channel ID name during check policy on signed data. Name must be different from nil.\")\n\t}\n\n\tif policyName == \"\" {\n\t\treturn fmt.Errorf(\"Invalid policy name during check policy on signed data on channel [%s]. Name must be different from nil.\", channelID)\n\t}\n\n\tif sd == nil {\n\t\treturn fmt.Errorf(\"Invalid signed data during check policy on channel [%s] with policy [%s]\", channelID, policyName)\n\t}\n\n\t// Get Policy\n\tpolicyManager := p.channelPolicyManagerGetter.Manager(channelID)\n\tif policyManager == nil {\n\t\treturn fmt.Errorf(\"Failed to get policy manager for channel [%s]\", channelID)\n\t}\n\n\t// Recall that get policy always returns a policy object\n\tpolicy, _ := policyManager.GetPolicy(policyName)\n\n\t// Evaluate the policy\n\terr := policy.EvaluateSignedData(sd)\n\tif err != nil {","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/policy/policy.go#L145-L181","documentation":"Returned by CheckPolicyBySignedData when the policyName parameter is an empty string. The channel ID was valid, but no policy name was supplied, so there is nothing to evaluate. The message includes the channel for easier diagnosis.","triggerScenarios":"Calling CheckPolicyBySignedData(channelID, \"\", sd) directly, or via CheckPolicy when the proposal's header carries an empty policy name (e.g. missing/blank policy reference extracted from the proposal header).","commonSituations":"SDK proposal header built without the policy name field; config key for policy name resolves to empty string; typos yielding blank value after trimming.","solutions":["Pass a valid policy name such as \"CHANNEL_READERS\" or \"CHANNEL_WRITERS\".","Fix the code/config that derives the policy name from the proposal header so it is populated.","Verify the named policy exists in the channel's configtx if unsure which name to use."],"exampleFix":"// before\nerr := checker.CheckPolicyBySignedData(\"mychannel\", \"\", sd)\n// after\nif policyName == \"\" { return errors.New(\"policyName is required\") }\nerr := checker.CheckPolicyBySignedData(\"mychannel\", \"CHANNEL_READERS\", sd)","handlingStrategy":"validation","validationCode":"if policyName == \"\" {\n    return errors.New(\"policy name must be non-empty (e.g. CHANNEL_READERS) before calling CheckPolicyBySignedData\")\n}","typeGuard":"func validPolicyName(name string) bool {\n    return name == \"CHANNEL_READERS\" || name == \"CHANNEL_WRITERS\" || name == \"CHANNEL_ADMINS\" || len(name) > 0\n}","tryCatchPattern":null,"preventionTips":["Use well-known policy name constants (CHANNEL_READERS/WRITERS/ADMINS) instead of free-form strings.","Fail fast on empty config-derived policy names at application startup.","Trim and check policy names extracted from proposal headers before use."],"tags":["fabric","validation","policy","argument-error"],"backgroundTag":"empty-required-argument","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"}