{"record":{"id":"9b9b2e3876f75d89","repo":"hyperledger/fabric","slug":"invalid-policy-name-during-channelless-check-polic","errorCode":null,"errorMessage":"Invalid policy name during channelless check policy. Name must be different from nil.","messagePattern":"Invalid policy name during channelless check policy\\. Name must be different from nil\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/policy/policy.go","lineNumber":109,"sourceCode":"\tshdr, err := protoutil.UnmarshalSignatureHeader(header.SignatureHeader)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Invalid Proposal's SignatureHeader during check policy on channel [%s] with policy [%s]: [%s]\", channelID, policyName, err)\n\t}\n\n\tsd := []*protoutil.SignedData{{\n\t\tData:      signedProp.ProposalBytes,\n\t\tIdentity:  shdr.Creator,\n\t\tSignature: signedProp.Signature,\n\t}}\n\n\treturn p.CheckPolicyBySignedData(channelID, policyName, sd)\n}\n\n// CheckPolicyNoChannel checks that the passed signed proposal is valid with the respect to\n// passed policy on the local MSP.\nfunc (p *policyChecker) CheckPolicyNoChannel(policyName string, signedProp *pb.SignedProposal) error {\n\tif policyName == \"\" {\n\t\treturn errors.New(\"Invalid policy name during channelless check policy. Name must be different from nil.\")\n\t}\n\n\tif signedProp == nil {\n\t\treturn fmt.Errorf(\"Invalid signed proposal during channelless check policy with policy [%s]\", policyName)\n\t}\n\n\tproposal, err := protoutil.UnmarshalProposal(signedProp.ProposalBytes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failing extracting proposal during channelless check policy with policy [%s]: [%s]\", policyName, err)\n\t}\n\n\theader, err := protoutil.UnmarshalHeader(proposal.Header)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failing extracting header during channelless check policy with policy [%s]: [%s]\", policyName, err)\n\t}\n\n\tshdr, err := protoutil.UnmarshalSignatureHeader(header.SignatureHeader)\n\tif err != nil {","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/policy/policy.go#L91-L127","documentation":"CheckPolicyNoChannel validates a signed proposal against a named policy on the local MSP without a channel. The policyName must be a non-empty string; if it is empty (the message says 'nil' but the check is against the empty string), the call is rejected immediately with this static error.","triggerScenarios":"Calling CheckPolicyNoChannel (directly or via CheckPolicy's channelless path) with policyName set to \"\" or an unset variable.","commonSituations":"Config where the policy name is read from a config/env var that is missing; callers confusing channel policy names with channelless policy names; a client omitting the policy name in an ACL-check request.","solutions":["Supply a valid non-empty policy name (e.g. \"Users\", \"Admins\", or \"/Channel/Application/Readers\")","Fix the config/env sourcing so the policy name variable is populated before the call","Validate the policy name in the caller before invoking CheckPolicyNoChannel"],"exampleFix":"// before\npolicyName := os.Getenv(\"POLICY\") // empty\nerr := pc.CheckPolicyNoChannel(policyName, signedProp)\n// after\npolicyName := os.Getenv(\"POLICY\")\nif policyName == \"\" { return errors.New(\"policy name required\") }\nerr := pc.CheckPolicyNoChannel(policyName, signedProp)","handlingStrategy":"validation","validationCode":"if (policyName == null || policyName.isEmpty()) {\n    throw new IllegalArgumentException(\"policyName required for channelless check\");\n}","typeGuard":"function hasPolicyName(name) { return typeof name === 'string' && name.trim().length > 0; }","tryCatchPattern":"err := checker.CheckPolicyNoChannel(policyName, signedProp)\nif err != nil {\n    if strings.Contains(err.Error(), \"Invalid policy name during channelless check policy\") {\n        // configuration problem: correct the policy name source\n    }\n    return err\n}","preventionTips":["Validate config values at startup","Provide defaults for policy names","Use constants for canonical policy names","Trim inputs before validation"],"tags":["hyperledger-fabric","policy","validation"],"backgroundTag":"invalid-policy-name","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"}