hashicorp/nomad · error
job not found
Error message
job not found
What it means
The Job.Evaluate RPC looked up the job by ID and namespace in the state store and got nil — no such job exists. Nomad throws this plain 'job not found' because it cannot force an evaluation for a job that was never registered or has been deregistered.
Source
Thrown at nomad/job_endpoint.go:714
}
// Validate the arguments
if args.JobID == "" {
return fmt.Errorf("missing job ID for evaluation")
}
// Lookup the job
snap, err := j.srv.fsm.State().Snapshot()
if err != nil {
return err
}
ws := memdb.NewWatchSet()
job, err := snap.JobByID(ws, args.RequestNamespace(), args.JobID)
if err != nil {
return err
}
if job == nil {
return fmt.Errorf("job not found")
}
if job.IsPeriodic() {
return fmt.Errorf("can't evaluate periodic job")
} else if job.IsParameterized() {
return fmt.Errorf("can't evaluate parameterized job")
}
forceRescheduleAllocs := make(map[string]*structs.DesiredTransition)
if args.EvalOptions.ForceReschedule {
// Find any failed allocs that could be force rescheduled
allocs, err := snap.AllocsByJob(ws, args.RequestNamespace(), args.JobID, false)
if err != nil {
return err
}
for _, alloc := range allocs {View on GitHub (pinned to 482b49bf1a)
Solutions
- Confirm the job exists: nomad job status <id> or GET /v1/job/<id>
- Check the namespace (NOMAD_NAMESPACE or -namespace flag) matches where the job lives
- Re-register the job first if it was deregistered, then evaluate
- Correct the job ID in the calling script
Example fix
// before
client.Jobs().Evaluate("web-app", nil)
// after
if _, _, err := client.Jobs().Info("web-app", nil); err != nil {
return fmt.Errorf("job web-app not found: %w", err)
}
client.Jobs().Evaluate("web-app", nil) Defensive patterns
Strategy: validation
Validate before calling
_, _, err := client.Jobs().Info(jobID, nil)
if err != nil { return fmt.Errorf("job %q not found before evaluate: %w", jobID, err) } Try / catch
_, _, err := client.Jobs().Evaluate(jobID, nil)
if err != nil && strings.Contains(err.Error(), "job not found") {
return fmt.Errorf("job %s missing; re-register it first", jobID)
} Prevention
- Check job existence with Jobs().Info before evaluating
- Confirm NOMAD_NAMESPACE matches where the job was registered
- Treat deregister+evaluate flows as ordered, not parallel
When it happens
Trigger: POST /v1/job/<id>/evaluate (or periodic force) where the job ID is misspelled, the job was deregistered, or the request namespace does not contain the job.
Common situations: CI pipelines evaluating a job after a failed deploy removed it; wrong namespace in token/policy resolution; idempotent scripts re-running after job cleanup; purge=true deregistration followed by a forced evaluation.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/06b38153308bedc5.
Report an issue: GitHub.