hashicorp/nomad · error

job not found

Error message

job not found

What it means

Periodic.Force looked up the job by ID in the requested namespace and found nothing; the job does not exist (wrong ID, wrong namespace, or not registered).

Source

Thrown at nomad/periodic_endpoint.go:70

	// 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() {
		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

  1. Verify the job ID with `nomad job status`
  2. Confirm you are targeting the correct namespace and region
  3. Register the job before force-running it

Example fix

// before
_, _, err := client.Jobs().PeriodicForce("my-job", nil) // may not exist
// after
job, _, err := client.Jobs().Info("my-job", nil)
if err != nil || job == nil { return fmt.Errorf("job %q not found in namespace", "my-job") }
_, _, err = client.Jobs().PeriodicForce("my-job", nil)
Defensive patterns

Strategy: validation

Validate before calling

// Go: verify job existence and namespace first
job, _, err := client.Jobs().Info(jobID, &api.QueryOptions{Namespace: ns})
if err != nil || job == nil {
    return fmt.Errorf("job %q not found in namespace %q", jobID, ns)
}

Try / catch

// Go
if _, err := client.Jobs().PeriodicForce(jobID, qo); err != nil {
    if strings.Contains(err.Error(), "job not found") {
        return fmt.Errorf("check job ID and namespace: %s/%s", ns, jobID)
    }
    return err
}

Prevention

When it happens

Trigger: Calling Force (RPC) with a JobID/namespace that doesn't match any registered job — deleted job, typo, or wrong namespace (RequestNamespace).

Common situations: Job purged between listing and force; default-namespace vs custom-namespace confusion; stale job ID in CI config; region mismatch querying a different cluster.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/8d85d36f281438cd. Report an issue: GitHub.