hashicorp/nomad · error
can't force launch non-periodic job
Error message
can't force launch non-periodic job
What it means
Periodic.Force found the job but it has no periodic spec (`period`/cron), so it cannot be force-launched; force-run only applies to periodic jobs.
Source
Thrown at nomad/periodic_endpoint.go:74
}
// 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() {
return fmt.Errorf("can't force launch non-periodic job")
}
// Force run the job.
eval, err := p.srv.periodicDispatcher.ForceEval(args.RequestNamespace(), job.ID)
if err != nil {
return fmt.Errorf("force launch for job %q failed: %v", job.ID, err)
}
reply.EvalID = eval.ID
reply.EvalCreateIndex = eval.CreateIndex
reply.Index = eval.CreateIndex
return nil
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Add a `period` or `cron` stanza to the job and register it
- Use `nomad job run`/dispatch for non-periodic jobs instead of force
Example fix
// before
client.Jobs().PeriodicForce("batch-job", nil) // non-periodic
// after
job, _, _ := client.Jobs().Info("batch-job", nil)
if job != nil && job.IsPeriodic() { // pseudo; check Periodic != nil
client.Jobs().PeriodicForce("batch-job", nil)
} else {
// use regular job dispatch instead
} Defensive patterns
Strategy: validation
Validate before calling
// Go: only force periodic jobs
job, _, err := client.Jobs().Info(jobID, nil)
if err == nil && job != nil && job.Periodic != nil {
// safe to PeriodicForce
} Type guard
// Go
func isPeriodic(j *api.Job) bool {
return j != nil && j.Periodic != nil && j.Periodic.Enabled != nil && *j.Periodic.Enabled
} Try / catch
// Go
if _, err := client.Jobs().PeriodicForce(jobID, nil); err != nil {
if strings.Contains(err.Error(), "non-periodic") {
return fmt.Errorf("%s is not periodic; use job dispatch/run instead", jobID)
}
return err
} Prevention
- Check job.Periodic != nil before any periodic-force call
- Distinguish periodic from parameterized/batch jobs in tooling
- Review job spec changes that drop the Periodic stanza
When it happens
Trigger: Calling Force / nomad job periodic force on a job registered with type service/batch/system instead of a job with a Periodic block.
Common situations: Copy-pasting a job ID of the wrong job; job spec lost its periodic block in a recent update; confusing 'periodic' dispatch with Cron in another system.
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/99a4362c908a5d8e.
Report an issue: GitHub.