hashicorp/nomad · error
alloc %v does not have a job
Error message
alloc %v does not have a job
What it means
consulHook.Prerun guard: h.alloc.Job is nil when the allocation's prerun hook executes. The code marks this as always a programming/state corruption error - every persisted allocation should carry its job - so it logs at Error level and aborts startup.
Source
Thrown at client/allocrunner/consul_hook.go:90
// statically assert the hook implements the expected interfaces
var (
_ interfaces.RunnerPrerunHook = (*consulHook)(nil)
_ interfaces.RunnerPostrunHook = (*consulHook)(nil)
_ interfaces.RunnerDestroyHook = (*consulHook)(nil)
_ interfaces.ShutdownHook = (*consulHook)(nil)
)
func (*consulHook) Name() string {
return "consul"
}
func (h *consulHook) Prerun(allocEnv *taskenv.TaskEnv) error {
job := h.alloc.Job
if job == nil {
// this is always a programming error
err := fmt.Errorf("alloc %v does not have a job", h.alloc.Name)
h.logger.Error(err.Error())
return err
}
// tokens are a map of Consul cluster to identity name to Consul ACL token.
tokens, err := h.resourcesBackend.loadAllocTokens()
if err != nil {
h.logger.Error("error reading stored ACL tokens", "error", err)
}
tg := job.LookupTaskGroup(h.alloc.TaskGroup)
if tg == nil { // this is always a programming error
return fmt.Errorf("alloc %v does not have a valid task group", h.alloc.Name)
}
var mErr *multierror.Error
if err := h.prepareConsulTokensForServices(tg.Services, tg, tokens, allocEnv); err != nil {
mErr = multierror.Append(mErr, err)View on GitHub (pinned to 482b49bf1a)
Solutions
- Report as a bug; this indicates alloc state corruption
- Check whether the alloc was restored from a truncated/partial state DB
- Delete the corrupt alloc directory / restart the client to force re-sync from servers
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at client/allocrunner/consul_hook.go:90 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/d701544e23877ed8.
Report an issue: GitHub.