{"record":{"id":"3d47c93fc417f15b","repo":"hashicorp/nomad","slug":"force-launch-for-job-q-failed-v","errorCode":null,"errorMessage":"force launch for job %q failed: %v","messagePattern":"force launch for job %q failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/periodic_endpoint.go","lineNumber":80,"sourceCode":"\t}\n\n\tws := memdb.NewWatchSet()\n\tjob, err := snap.JobByID(ws, args.RequestNamespace(), args.JobID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif job == nil {\n\t\treturn fmt.Errorf(\"job not found\")\n\t}\n\n\tif !job.IsPeriodic() {\n\t\treturn fmt.Errorf(\"can't force launch non-periodic job\")\n\t}\n\n\t// Force run the job.\n\teval, err := p.srv.periodicDispatcher.ForceEval(args.RequestNamespace(), job.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"force launch for job %q failed: %v\", job.ID, err)\n\t}\n\n\treply.EvalID = eval.ID\n\treply.EvalCreateIndex = eval.CreateIndex\n\treply.Index = eval.CreateIndex\n\treturn nil\n}\n","sourceCodeStart":62,"sourceCodeEnd":88,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/periodic_endpoint.go#L62-L88","documentation":"This error is returned by the Periodic.ForceLaunch RPC handler when forcing an immediate launch of a periodic job fails. It wraps the error from the server's periodicDispatcher.ForceEval call, which creates an evaluation to run the job now. It means the dispatcher refused or failed to schedule the forced run, not that the RPC itself was malformed (a non-periodic job is rejected earlier with a distinct message).","triggerScenarios":"Calling Periodic.ForceLaunch (nomad job periodic force or the Force public method) on a periodic job whose ID is not registered with the server's periodic dispatcher — e.g. the job was just deregistered, the leader changed and dispatcher state is being rebuilt, or the dispatcher no longer tracks the job.","commonSituations":"Race between job deregistration and a force-launch call; operator scripting `nomad job periodic force` against a job that was just removed; leadership transitions in a busy cluster; stale CLI caching a job ID after it was purged.","solutions":["Verify the periodic job still exists and is enabled with `nomad job status <job>` before forcing","Retry the force launch after a short delay (dispatcher state may be rebuilding after a leader election)","Re-register the periodic job (`nomad job run <file>`) and then force launch","Check server logs for the underlying dispatcher error to identify deregistration vs internal failure"],"exampleFix":"// before\nnomad job periodic force my-job\n// after\nnomad job status my-job || nomad job run my-job.nomad\nnomad job periodic force my-job","handlingStrategy":"retry","validationCode":"status, _, err := client.Jobs().Info(jobID, nil)\nif err != nil || status == nil {\n    // job missing; re-register before forcing\n}\n// also confirm job.Periodic != nil before calling ForceLaunch","typeGuard":"func isForceLaunchErr(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"force launch for job\")\n}","tryCatchPattern":"eval, _, err := client.Jobs().Periodic().ForceLaunch(jobID, nil)\nif err != nil {\n    if strings.Contains(err.Error(), \"force launch for job\") {\n        time.Sleep(2 * time.Second) // retry; dispatcher may be rebuilding after leader election\n        eval, _, err = client.Jobs().Periodic().ForceLaunch(jobID, nil)\n    }\n    if err != nil { return err }\n}","preventionTips":["Check the job exists and is periodic before forcing","Delay force launches right after leader elections or deregistrations","Alert on the underlying dispatcher error in server logs"],"tags":["nomad","rpc","periodic-jobs","scheduler"],"backgroundTag":"periodic-job-force-launch-failed","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}