hashicorp/nomad · error
job %s does not have allocation %s
Error message
job %s does not have allocation %s
What it means
Returned by execImpl when the exec request carries a JobID that differs from the allocation's actual JobID. This is a client-side mismatch guard so exec cannot be issued against an allocation belonging to a different job.
Source
Thrown at client/alloc_endpoint.go:300
a.c.logger.Info("task exec session starting", logArgs...)
}
// Check alloc-exec permission.
if err != nil {
return new(int64(400)), err
} else if !aclObj.AllowNsOp(alloc.Namespace, acl.NamespaceCapabilityAllocExec) {
return nil, nstructs.ErrPermissionDenied
}
// Validate the arguments
if req.Task == "" {
return new(int64(400)), taskNotPresentErr
}
if req.JobID != "" && req.JobID != alloc.JobID {
return new(int64(http.StatusBadRequest)),
fmt.Errorf("job %s does not have allocation %s", req.JobID, req.AllocID)
}
// If an action is present, go find the command and args
if req.Action != "" {
task := alloc.LookupTask(req.Task)
if task == nil {
return new(int64(http.StatusBadRequest)),
fmt.Errorf("task %s not found in allocation %s", req.Task, alloc.ID)
}
jobAction := task.GetAction(req.Action)
if jobAction == nil {
return new(int64(http.StatusBadRequest)),
fmt.Errorf("action %s not found in task %s", req.Action, req.Task)
}
// append both Command and Args
req.Cmd = append([]string{jobAction.Command}, jobAction.Args...)
}View on GitHub (pinned to 482b49bf1a)
Solutions
- Compare req.JobID with the target allocation's JobID using nomad alloc status
- Omit the job_id field or pass the allocation's actual job ID
- Re-run the exec command against the correct allocation
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at client/alloc_endpoint.go:300 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/f50258623b7148dc.
Report an issue: GitHub.