hyperledger/fabric · error
No such policy
Error message
No such policy
What it means
EvaluateIdentities has the same nil-receiver guard as EvaluateSignedData: evaluating identities through a nil *policy means the policy object was never constructed, and the caller gets 'No such policy'.
Source
Thrown at common/cauthdsl/policy.go:100
// EvaluateSignedData takes a set of SignedData and evaluates whether
// 1) the signatures are valid over the related message
// 2) the signing identities satisfy the policy
func (p *policy) EvaluateSignedData(signatureSet []*protoutil.SignedData) error {
if p == nil {
return errors.New("no such policy")
}
ids := policies.SignatureSetToValidIdentities(signatureSet, p.deserializer)
return p.EvaluateIdentities(ids)
}
// EvaluateIdentities takes an array of identities and evaluates whether
// they satisfy the policy
func (p *policy) EvaluateIdentities(identities []msp.Identity) error {
if p == nil {
return fmt.Errorf("No such policy")
}
ok := p.evaluator(identities, make([]bool, len(identities)))
if !ok {
return errors.New("signature set did not satisfy policy")
}
return nil
}
func (p *policy) Convert() (*cb.SignaturePolicyEnvelope, error) {
if p.signaturePolicyEnvelope == nil {
return nil, errors.New("nil policy field")
}
return p.signaturePolicyEnvelope, nil
}
View on GitHub (pinned to 2736b63f8f)
Solutions
- Guard the policy pointer for nil before evaluation
- Correct the policy lookup/construction so a valid *policy is obtained
- Define the missing policy in channel configuration
Example fix
// before
var p *policy
err := p.EvaluateIdentities(ids)
// after
if p == nil {
return errors.New("no policy configured")
}
err := p.EvaluateIdentities(ids) Defensive patterns
Strategy: type-guard
Validate before calling
if p == nil {
return errors.New("cannot evaluate: policy object is nil")
} Type guard
func isEvaluatable(p *policy) bool { return p != nil && p.evaluator != nil } Try / catch
err := pol.EvaluateIdentities(ids)
if err != nil && err.Error() == "No such policy" {
return errors.New("policy handle is nil; re-resolve from the policy manager")
} Prevention
- Propagate policy-construction errors instead of retaining a nil handle
- Centralize policy lookup so nil results are rejected once
- Add nil checks at every call site rather than relying on the library guard
When it happens
Trigger: Calling EvaluateIdentities on a nil *policy — the result of a failed/absent policy resolution — instead of a compiled policy.
Common situations: Same as error 75: missing channel policy definitions, mistyped policy IDs, or code paths that ignore construction errors and keep a nil policy handle.
Related errors
- no such policy
- nil policy field
- could not retrieve policy for reference '%s' on channel '%s'
- Invalid signed proposal during channelless check policy with
- organization %s not found
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/bb114ae314a87850.
Report an issue: GitHub.