hashicorp/nomad · error
scaling policy lookup failed: %v
Error message
scaling policy lookup failed: %v
What it means
ScalingPoliciesByIDPrefix performs a prefix lookup on the scaling_policy "id_prefix" index; a memdb transaction error is wrapped as "scaling policy lookup failed: %v". The result is then filtered by namespace, so an empty match set is normal and not an error.
Source
Thrown at nomad/state/state_store.go:7384
if p.Type == typ {
existing = p
break
}
}
if existing != nil {
return existing, nil
}
return nil, nil
}
func (s *StateStore) ScalingPoliciesByIDPrefix(ws memdb.WatchSet, namespace string, prefix string) (memdb.ResultIterator, error) {
txn := s.db.ReadTxn()
iter, err := txn.Get("scaling_policy", "id_prefix", prefix)
if err != nil {
return nil, fmt.Errorf("scaling policy lookup failed: %v", err)
}
ws.Add(iter.WatchCh())
iter = memdb.NewFilterIterator(iter, scalingPolicyNamespaceFilter(namespace))
return iter, nil
}
// scalingPolicyNamespaceFilter returns a filter function that filters all
// scaling policies not targeting the given namespace.
func scalingPolicyNamespaceFilter(namespace string) func(any) bool {
return func(raw any) bool {
p, ok := raw.(*structs.ScalingPolicy)
if !ok {
return true
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Inspect the wrapped cause in the error/agent logs.
- Retry the query, possibly targeting another server.
- Check cluster/store health and Nomad version for known fixes.
Defensive patterns
Strategy: retry
Try / catch
iter, err := /* prefix list call */
if err != nil {
if strings.Contains(err.Error(), "scaling policy lookup failed") {
// retry on another server with backoff
}
} Prevention
- Retry prefix queries transiently; they fail only on store faults, not empty results.
- Monitor server health and route queries away from degraded servers.
When it happens
Trigger: GET /v1/scaling/policy/prefix/<prefix> (list by ID prefix) when the prefix index query fails.
Common situations: Rare store-level faults; occasionally seen in tooling that does prefix-based pagination against a degraded server.
Related errors
- scaling policy not found
- scaling policy delete failed: %v
- scaling_policy lookup failed: %v
- error parsing: root should be an object
- cannot specify Accessor ID
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/a3aae06d5140f3a4.
Report an issue: GitHub.