hashicorp/nomad · error

scaling policy delete failed: %v

Error message

scaling policy delete failed: %v

What it means

After finding the scaling policy, DeleteScalingPolicy calls txn.Delete on the scaling_policy table; if the underlying memdb/MemDB transaction delete fails, the error is wrapped as "scaling policy delete failed: %v". This indicates an internal transaction problem, not a missing policy.

Source

Thrown at nomad/state/state_store.go:7215

// DeleteScalingPoliciesTxn is used to delete a set of scaling policies by ID.
func (s *StateStore) DeleteScalingPoliciesTxn(index uint64, ids []string, txn *txn) error {
	if len(ids) == 0 {
		return nil
	}

	for _, id := range ids {
		// Lookup the scaling policy
		existing, err := txn.First("scaling_policy", "id", id)
		if err != nil {
			return fmt.Errorf("scaling policy lookup failed: %v", err)
		}
		if existing == nil {
			return fmt.Errorf("scaling policy not found")
		}

		// Delete the scaling policy
		if err := txn.Delete("scaling_policy", existing); err != nil {
			return fmt.Errorf("scaling policy delete failed: %v", err)
		}
	}

	if err := txn.Insert("index", &IndexEntry{"scaling_policy", index}); err != nil {
		return fmt.Errorf("index update failed: %v", err)
	}

	return nil
}

// ScalingPolicies returns an iterator over all the scaling policies
func (s *StateStore) ScalingPolicies(ws memdb.WatchSet) (memdb.ResultIterator, error) {
	txn := s.db.ReadTxn()

	// Walk the entire scaling_policy table
	iter, err := txn.Get("scaling_policy", "id")
	if err != nil {
		return nil, err

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Check the wrapped cause in the full error string/agent logs.
  2. Retry the delete; the transaction may have aborted transiently.
  3. If persistent, verify cluster health and consider restoring the state store from backup.
Defensive patterns

Strategy: retry

Try / catch

var retriableErr *gomdb.ErrNotFound // inspect wrapped cause instead
if strings.HasPrefix(err.Error(), "scaling policy delete failed:") {
    // log wrapped cause, retry after backoff; escalate if persistent
}

Prevention

When it happens

Trigger: A scaling policy delete RPC where the internal txn.Delete returns an error (e.g., invalid transaction state or store-level write failure).

Common situations: Rare internal state-store faults; typically surfaced alongside raft/apply errors or store corruption; effectively never caused by user input.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/2db99b2febff488a. Report an issue: GitHub.