hashicorp/nomad · error
missing job ID for evaluation
Error message
missing job ID for evaluation
What it means
The Periodic.Force RPC failed argument validation: JobID in the periodic force request is empty, so there is no job to force-launch.
Source
Thrown at nomad/periodic_endpoint.go:55
if authErr != nil {
return structs.ErrPermissionDenied
}
defer metrics.MeasureSince([]string{"nomad", "periodic", "force"}, time.Now())
// Check for write-job permissions
if aclObj, err := p.srv.ResolveACL(args); err != nil {
return err
} else if !aclObj.AllowNsOpAnyOf(args.RequestNamespace(),
acl.NamespaceCapabilityDispatchJob,
acl.NamespaceCapabilitySubmitJob,
acl.NamespaceCapabilityForcePeriodicJob,
) {
return structs.ErrPermissionDenied
}
// Validate the arguments
if args.JobID == "" {
return fmt.Errorf("missing job ID for evaluation")
}
// Lookup the job
snap, err := p.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() {View on GitHub (pinned to 482b49bf1a)
Solutions
- Set JobID on the PeriodicForceRequest
- Verify the CLI/API invocation actually passed a job ID
Example fix
// before
req := &api.PeriodicForceRequest{JobID: os.Getenv("JOB_ID")} // may be empty
// after
jobID := os.Getenv("JOB_ID")
if jobID == "" { return errors.New("JOB_ID must be set") }
req := &api.PeriodicForceRequest{JobID: jobID} Defensive patterns
Strategy: validation
Validate before calling
// Go
if jobID == "" {
return errors.New("job ID is required for periodic force")
} Try / catch
// Go
_, err := client.Jobs().PeriodicForce(jobID, nil)
if err != nil && strings.Contains(err.Error(), "missing job ID") {
return fmt.Errorf("client bug: empty JobID sent: %w", err)
} Prevention
- Validate CLI args/flags before building the RPC
- Fail fast on empty env variables used as job IDs
- Add unit tests for empty-argument handling
When it happens
Trigger: Sending a PeriodicForceRequest with args.JobID == "" to the Force endpoint via RPC or the nomad job periodic force CLI/API with a blank job name.
Common situations: Empty variable interpolation in scripts/CI; unset environment variable used as job ID; CLI invoked with flags but no positional job ID.
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
- Must provide the NodeID
- Parameter for choose must be in form '<number>|<key>'
- missing node for client registration
- missing node ID for client registration
- missing datacenter for client registration
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/4c814df461ea58e2.
Report an issue: GitHub.