{"record":{"id":"56a028b0e7195993","repo":"hyperledger/fabric","slug":"state-based-endorsement-policy-cannot-be-satisfied","errorCode":null,"errorMessage":"state based endorsement policy cannot be satisfied","messagePattern":"state based endorsement policy cannot be satisfied","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"discovery/endorsement/endorsement.go","lineNumber":239,"sourceCode":"\t\tif len(chaincode.KeyPolicies) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tlogger.Debugf(\"Chaincode call to %s is satisfied by %d state based policies of %v\",\n\t\t\tchaincode.Name, len(chaincode.KeyPolicies), chaincode.KeyPolicies)\n\n\t\tfor _, stateBasedPolicy := range chaincode.KeyPolicies {\n\t\t\tvar cmpsets inquire.ComparablePrincipalSets\n\t\t\tstateBasedPolicy := inquire.NewInquireableSignaturePolicy(stateBasedPolicy)\n\t\t\tfor _, ps := range stateBasedPolicy.SatisfiedBy() {\n\t\t\t\tcps := inquire.NewComparablePrincipalSet(ps)\n\t\t\t\tif cps == nil {\n\t\t\t\t\treturn nil, errors.New(\"failed creating a comparable principal set for state based endorsement\")\n\t\t\t\t}\n\t\t\t\tcmpsets = append(cmpsets, cps)\n\t\t\t}\n\t\t\tif len(cmpsets) == 0 {\n\t\t\t\treturn nil, errors.New(\"state based endorsement policy cannot be satisfied\")\n\t\t\t}\n\t\t\tstateBasedCPS = append(stateBasedCPS, cmpsets)\n\t\t}\n\t}\n\n\tif len(stateBasedCPS) > 0 {\n\t\tstateBasedPrincipalSet, err := mergePrincipalSets(stateBasedCPS)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\n\t\tlogger.Debugf(\"Merging state based policies: %v --> %v\", stateBasedCPS, stateBasedPrincipalSet)\n\n\t\treturn stateBasedPrincipalSet, nil\n\t}\n\n\tlogger.Debugf(\"No state based policies requested\")\n","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/discovery/endorsement/endorsement.go#L221-L257","documentation":"Thrown by computeStateBasedPrincipalSets when a chaincode's state-based (key-level) endorsement policy produced zero comparable principal sets from SatisfiedBy(), i.e. no combination of principals can ever satisfy the policy. Discovery cannot return any peer group that would fulfill this key-level endorsement requirement, so the request is rejected.","triggerScenarios":"A KeyPolicy on a chaincode in a ChaincodeInterest inquires to an empty set of satisfying principal combinations — e.g. a signature policy that is logically unsatisfiable (NOutOf threshold exceeding the number of principals, or principals from nonexistent MSPs) or a policy with no satisfying principals.","commonSituations":"State-based endorsement set with 'OutOf(2, ...)' but only one principal; key-level policies referencing MSP IDs that are not on the channel; policies attached to private data keys whose collections changed.","solutions":["Review the key-level endorsement policy logic and lower the NOutOf threshold or add principals so it can be satisfied","Ensure all MSPs referenced by the state-based policy exist on the channel (update channel config)","Delete/reset the state-based endorsement policy for the affected keys (unset validation parameter)","If intentionally strict, stop requesting PeersForEndorsement for that chaincode/key combination"],"exampleFix":"// before\npolicy := NOutOf(2, principals(len=1)) // unsatisfiable\n// after\npolicy := NOutOf(1, principals(len=1))","handlingStrategy":"validation","validationCode":"policy := inquire.NewInquireableSignaturePolicy(keyPolicy)\nif len(policy.SatisfiedBy()) == 0 {\n  return errors.New(\"state-based endorsement policy is unsatisfiable\")\n}","typeGuard":"func satisfiable(p *common.SignaturePolicyEnvelope) bool {\n  return len(inquire.NewInquireableSignaturePolicy(p).SatisfiedBy()) > 0\n}","tryCatchPattern":"peers, err := client.PeersForEndorsement(ctx, interest)\nif err != nil && strings.Contains(err.Error(), \"cannot be satisfied\") {\n  // inspect/recreate the key-level policy before retrying\n}","preventionTips":["Ensure NOutOf thresholds never exceed the number of listed principals","Reference only MSPs defined in channel config","Clear validation parameters on keys whose policies reference removed orgs"],"tags":["fabric","discovery","endorsement-policy","state-based-endorsement"],"backgroundTag":"endorsement-policy-unsatisfiable","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"}