hashicorp/nomad · error

destroy hook %q failed: %v

Error message

destroy hook %q failed: %v

What it means

During alloc runner destroy, a registered RunnerDestroyHook's Destroy method returned an error; it is wrapped with the hook name and appended to a multierror so remaining destroy hooks still run. The allocation teardown proceeds but cleanup for that hook may be incomplete.

Source

Thrown at client/allocrunner/alloc_runner_hooks.go:325

		}()
	}

	var merr multierror.Error
	for _, hook := range ar.runnerHooks {
		h, ok := hook.(interfaces.RunnerDestroyHook)
		if !ok {
			continue
		}

		name := h.Name()
		var start time.Time
		if ar.logger.IsTrace() {
			start = time.Now()
			ar.logger.Trace("running destroy hook", "name", name, "start", start)
		}

		if err := h.Destroy(); err != nil {
			merr.Errors = append(merr.Errors, fmt.Errorf("destroy hook %q failed: %v", name, err))
		}

		if ar.logger.IsTrace() {
			end := time.Now()
			ar.logger.Trace("finished destroy hooks", "name", name, "end", end, "duration", end.Sub(start))
		}
	}

	return merr.ErrorOrNil()
}

func (ar *allocRunner) preKillHooks() {
	for _, hook := range ar.runnerHooks {
		pre, ok := hook.(interfaces.RunnerPreKillHook)

		if !ok {
			continue
		}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Read the wrapped inner error to identify which hook failed and why
  2. Check client logs around destroy time for the hook's own error details
  3. Re-run cleanup manually if resources were leaked (e.g. network, cgroups)
  4. Restart the client if the alloc is stuck in a non-terminal state
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at client/allocrunner/alloc_runner_hooks.go:325 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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