hashicorp/nomad · error
missing job ID for evaluation
Error message
missing job ID for evaluation
What it means
The Job.Evaluate RPC forces a new evaluation for a job, and this guard rejects requests with an empty JobID before any state lookup. Nomad throws it because evaluation is always scoped to a specific job; an empty ID is an invalid client request.
Source
Thrown at nomad/job_endpoint.go:700
j.srv.MeasureRPCRate("job", structs.RateMetricWrite, args)
if authErr != nil {
return structs.ErrPermissionDenied
}
defer metrics.MeasureSince([]string{"nomad", "job", "evaluate"}, time.Now())
// Check for submit-job permissions
if aclObj, err := j.srv.ResolveACL(args); err != nil {
return err
} else if !aclObj.AllowNsOpAnyOf(args.RequestNamespace(),
acl.NamespaceCapabilitySubmitJob,
acl.NamespaceCapabilityEvaluateJob,
) {
return structs.ErrPermissionDenied
}
// 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")View on GitHub (pinned to 482b49bf1a)
Solutions
- Set JobID on the JobEvaluateRequest (or use the HTTP endpoint path /v1/job/<id>/evaluate which fills it in)
- Validate the job ID variable is non-empty before issuing the request
- Use the official nomad/api client Jobs().Evaluate(id, ...) rather than hand-built RPC payloads
Example fix
// before
_, _, err := client.Jobs().Evaluate("", nil)
// after
jobID := os.Getenv("NOMAD_JOB_ID")
if jobID == "" { return fmt.Errorf("job id required") }
_, _, err := client.Jobs().Evaluate(jobID, nil) Defensive patterns
Strategy: validation
Validate before calling
if jobID == "" {
return fmt.Errorf("jobID must be non-empty before calling Evaluate")
} Prevention
- Use client.Jobs().Evaluate(id, nil) so the ID comes from one parameter
- Assert non-empty identifiers at automation entry points
- Never hand-build JobEvaluateRequest bodies
When it happens
Trigger: Calling the Evaluate RPC (POST /v1/job/<id>/evaluate) where the request body's JobID field is empty — typically building the JobEvaluateRequest manually instead of letting the HTTP handler populate it from the URL path.
Common situations: Custom automation constructing api.JobEvaluateRequest{} without setting JobID; SDK wrappers that drop the path parameter; refactored scripts after switching from job prefix endpoints.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- missing secret ID
- namespace cannot contain template delimiters or parenthesis
- wait config is nil or empty
- CSI.ControllerAttachVolume: VolumeID is required
- CSI.ControllerAttachVolume: ClientCSINodeID is required
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/4360cb9b895697fb.
Report an issue: GitHub.