{"record":{"id":"28e1ecc6c36922a2","repo":"hyperledger/fabric","slug":"failed-creating-a-comparable-principal-set","errorCode":null,"errorMessage":"failed creating a comparable principal set","messagePattern":"failed creating a comparable principal set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"discovery/endorsement/endorsement.go","lineNumber":297,"sourceCode":"\t\t\t\tsessionLogger.Debugf(\"Client requested to disregard the namespace policy for chaincode %s,\"+\n\t\t\t\t\t\" and no collection policies are present\", chaincode.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsessionLogger.Debugf(\"Client requested to disregard the namespace policy for chaincode %s,\"+\n\t\t\t\t\" however there exist %d collection policies taken into account\", chaincode.Name, len(policies)-1)\n\t\t\tpolicies = policies[1:]\n\t\t}\n\t\tinquireablePoliciesForChaincodeAndCollections = append(inquireablePoliciesForChaincodeAndCollections, policies...)\n\t}\n\n\tvar cpss []inquire.ComparablePrincipalSets\n\n\tfor _, policy := range inquireablePoliciesForChaincodeAndCollections {\n\t\tvar cmpsets inquire.ComparablePrincipalSets\n\t\tfor _, ps := range policy.SatisfiedBy() {\n\t\t\tcps := inquire.NewComparablePrincipalSet(ps)\n\t\t\tif cps == nil {\n\t\t\t\treturn nil, errors.New(\"failed creating a comparable principal set\")\n\t\t\t}\n\t\t\tcmpsets = append(cmpsets, cps)\n\t\t}\n\t\tif len(cmpsets) == 0 {\n\t\t\treturn nil, errors.New(\"endorsement policy cannot be satisfied\")\n\t\t}\n\t\tcpss = append(cpss, cmpsets)\n\t}\n\n\tstateBasedCPS, err := computeStateBasedPrincipalSets(interest.Chaincodes, sessionLogger)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tif len(stateBasedCPS) > 0 {\n\t\tcpss = append(cpss, stateBasedCPS)\n\t}\n","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/discovery/endorsement/endorsement.go#L279-L315","documentation":"Thrown by computePrincipalSets when NewComparablePrincipalSet returns nil while converting a principal set produced by a chaincode's (namespace or collection) endorsement policy via SatisfiedBy(). The policy yielded a principal the inquire package cannot represent, so discovery cannot rank peers against the endorsement policy and fails the PeersForEndorsement request.","triggerScenarios":"A committed chaincode endorsement policy (namespace or collection policy) contains principal types or structures that inquire.NewComparablePrincipalSet cannot convert (unsupported MSPPrincipal classification, nil/invalid principals inside the policy protobuf).","commonSituations":"Endorsement policies written with nonstandard principals by custom tooling; corrupted or hand-edited policy definitions; channel policies using principal categories not supported at this Fabric version.","solutions":["Inspect the chaincode endorsement policy for unsupported principal types and redefine it using standard MSPRole/OU/peer principals","Re-commit the chaincode (or update collection config) with a standard policy, e.g. AND('Org1MSP.peer','Org2MSP.peer')","Upgrade Fabric so the inquire package supports the principal type in use","Verify the policy definition tooling emits valid common.SignaturePolicyEnvelope protos"],"exampleFix":"// before\npolicy := \"OR(ROLE('member', unknownDomain))\" // malformed principal\n// after\npolicy := \"AND('Org1MSP.peer', 'Org2MSP.peer')\"","handlingStrategy":"validation","validationCode":"for _, ps := range policy.SatisfiedBy() {\n  if inquire.NewComparablePrincipalSet(ps) == nil {\n    return errors.New(\"endorsement policy contains unsupported principals\")\n  }\n}","typeGuard":"func convertible(policy policies.InquireablePolicy) bool {\n  for _, ps := range policy.SatisfiedBy() {\n    if inquire.NewComparablePrincipalSet(ps) == nil { return false }\n  }\n  return true\n}","tryCatchPattern":"peers, err := client.PeersForEndorsement(ctx, interest)\nif err != nil && strings.Contains(err.Error(), \"failed creating a comparable principal set\") {\n  // inspect and redefine the committed endorsement policy\n}","preventionTips":["Define endorsement policies only with standard MSPRole/OU principals","Avoid hand-edited policy protobufs; use peer CLI/SDK builders","Validate policy envelopes after generation, before commit"],"tags":["fabric","discovery","endorsement-policy","principal-conversion"],"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"}