hashicorp/nomad · error
scaling_policy lookup failed: %v
Error message
scaling_policy lookup failed: %v
What it means
ScalingPolicyByID fetches a scaling policy by ID with txn.FirstWatch; if the underlying read transaction errors, the failure is wrapped as "scaling_policy lookup failed: %v". Note this fires only on memdb read errors — a missing policy simply returns nil, not this error.
Source
Thrown at nomad/state/state_store.go:7333
d, ok := raw.(*structs.ScalingPolicy)
if !ok {
return true
}
return d.Target[structs.ScalingTargetJob] != jobID
}
// Wrap the iterator in a filter
wrap := memdb.NewFilterIterator(iter, filter)
return wrap, nil
}
func (s *StateStore) ScalingPolicyByID(ws memdb.WatchSet, id string) (*structs.ScalingPolicy, error) {
txn := s.db.ReadTxn()
watchCh, existing, err := txn.FirstWatch("scaling_policy", "id", id)
if err != nil {
return nil, fmt.Errorf("scaling_policy lookup failed: %v", err)
}
ws.Add(watchCh)
if existing != nil {
return existing.(*structs.ScalingPolicy), nil
}
return nil, nil
}
// ScalingPolicyByTargetAndType returns a fully-qualified policy against a target and policy type,
// or nil if it does not exist. This method does not honor the watchset on the policy type, just the target.
func (s *StateStore) ScalingPolicyByTargetAndType(ws memdb.WatchSet, target map[string]string, typ string) (*structs.ScalingPolicy,
error) {
txn := s.db.ReadTxn()
namespace := target[structs.ScalingTargetNamespace]
job := target[structs.ScalingTargetJob]View on GitHub (pinned to 482b49bf1a)
Solutions
- Inspect the wrapped cause in the error string and agent logs.
- Retry the request.
- Check Nomad version for known state-store bugs and upgrade if affected.
Defensive patterns
Strategy: retry
Try / catch
policy, err := client.Scaling().GetPolicy(id, nil)
if err != nil {
if strings.Contains(err.Error(), "scaling_policy lookup failed") {
// store read fault: retry with backoff; a nil/empty result means not found
}
} Prevention
- Distinguish not-found (empty result) from read faults (this error) when handling.
- Check Nomad release notes for state-store fixes when upgrading.
When it happens
Trigger: GET /v1/scaling/policy/<id> or internal job scaling evaluation when the state store's read transaction fails (bad index lookup, store fault).
Common situations: Rare; store-level faults, version-specific memdb issues, or corruption. Not caused by wrong IDs (those return empty results).
Related errors
- launch lookup failed: %v
- scaling policy not found
- scaling policy delete failed: %v
- scaling policy lookup failed: %v
- ACL binding rules lookup failed: %v
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/9794ca308e00793a.
Report an issue: GitHub.