hyperledger/fabric · error
no such policy: '%s'
Error message
no such policy: '%s'
What it means
rejectPolicy is a sentinel Policy that always fails. EvaluateSignedData on it throws 'no such policy' carrying the policy name; it is used so lookups for missing policies return a policy whose evaluation always errors.
Source
Thrown at common/policies/policy.go:250
}
for groupName, manager := range managers {
for policyName, policy := range manager.Policies {
policies[groupName+PathSeparator+policyName] = policy
}
}
return &ManagerImpl{
path: path,
Policies: policies,
managers: managers,
}, nil
}
type rejectPolicy string
func (rp rejectPolicy) EvaluateSignedData(signedData []*protoutil.SignedData) error {
return errors.Errorf("no such policy: '%s'", rp)
}
func (rp rejectPolicy) EvaluateIdentities(identities []mspi.Identity) error {
return errors.Errorf("no such policy: '%s'", rp)
}
// Manager returns the sub-policy manager for a given path and whether it exists
func (pm *ManagerImpl) Manager(path []string) (Manager, bool) {
logger.Debugf("Manager %s looking up path %v", pm.path, path)
for manager := range pm.managers {
logger.Debugf("Manager %s has managers %s", pm.path, manager)
}
if len(path) == 0 {
return pm, true
}
m, ok := pm.managers[path[0]]
if !ok {View on GitHub (pinned to 2736b63f8f)
Solutions
- Use Manager(path) to check policy existence before evaluating, or handle the error as 'policy absent'
- Fix the policy name to match one defined in channel config (case-sensitive)
- Add the missing policy via a channel configuration update
Example fix
// before
p, _ := mgr.GetPolicy("Writters")
err := p.EvaluateSignedData(sd) // 'no such policy'
// after
if _, ok := mgr.Manager(nil); ok {
p, _ := mgr.GetPolicy("Writers")
err := p.EvaluateSignedData(sd)
} Defensive patterns
Strategy: type-guard
Validate before calling
// Check existence before using GetPolicy output
if _, ok := mgr.Manager(path); !ok {
return fmt.Errorf("no policy manager at path %v", path)
} Type guard
func isRejectPolicy(p policies.Policy) bool {
_, ok := p.(policies.rejectPolicy)
return ok
} Try / catch
err := policy.EvaluateSignedData(sd)
if err != nil && strings.Contains(err.Error(), "no such policy") {
// policy absent from config: surface a config error, do not retry
} Prevention
- Spell policy names exactly as defined in channel config (case-sensitive)
- Check Manager(path) existence before GetPolicy
- Confirm policies exist after every channel config update
When it happens
Trigger: Calling ManagerImpl.GetPolicy(name) for a policy name that does not exist in the manager, then invoking EvaluateSignedData on the returned rejectPolicy.
Common situations: Requesting 'Writers'/'Readers'/'Admins' policies misspelled or absent from channel config; evaluating a policy from an older channel that has since been renamed; application code assuming a default policy exists.
Related errors
- failed evaluating policy on signed data during check policy
- Failed evaluating policy on signed data during check policy
- malformed org definition for org: %s
- organization %s not found
- error encode input
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/bfdb7b735db92b51.
Report an issue: GitHub.