{"record":{"id":"35cc8298ef6aa312","repo":"hashicorp/nomad","slug":"error-fetching-job-v","errorCode":null,"errorMessage":"Error fetching job: %v","messagePattern":"Error fetching job: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/deployment_status.go","lineNumber":604,"sourceCode":"\t\treturn base\n\t}\n\tbase += \"\\n\\n[bold]Deployed[reset]\\n\"\n\tbase += formatDeploymentGroups(d.TaskGroups, uuidLength)\n\treturn base\n}\n\ntype regionResult struct {\n\tregion string\n\td      *api.Deployment\n\terr    error\n}\n\nfunc fetchMultiRegionDeployments(c *api.Client, d *api.Deployment) (map[string]*api.Deployment, error) {\n\tresults := make(map[string]*api.Deployment)\n\n\tjob, _, err := c.Jobs().Info(d.JobID, &api.QueryOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error fetching job: %v\", err)\n\t}\n\n\trequests := make(chan regionResult, len(job.Multiregion.Regions))\n\tfor i := 0; i < cap(requests); i++ {\n\t\tgo func(itr int) {\n\t\t\tregion := job.Multiregion.Regions[itr]\n\t\t\td, err := fetchRegionDeployment(c, d, region)\n\t\t\trequests <- regionResult{d: d, err: err, region: region.Name}\n\t\t}(i)\n\t}\n\tfor i := 0; i < cap(requests); i++ {\n\t\tres := <-requests\n\t\tif res.err != nil {\n\t\t\tkey := fmt.Sprintf(\"%s (error)\", res.region)\n\t\t\tresults[key] = &api.Deployment{}\n\t\t\tcontinue\n\t\t}\n\t\tresults[res.region] = res.d","sourceCodeStart":586,"sourceCodeEnd":622,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/deployment_status.go#L586-L622","documentation":"fetchMultiRegionDeployments first fetches the job (needed to enumerate its multiregion regions) via c.Jobs().Info. If that API call fails, the error is wrapped as \"Error fetching job: %v\". The job lookup is a prerequisite for the per-region deployment queries.","triggerScenarios":"formatDeployment → fetchMultiRegionDeployments on a multiregion deployment when the Jobs().Info API call errors: job deleted/GC'd, connection refused, ACL token lacking job read permission, or wrong region in QueryOptions.","commonSituations":"The parent job was purged while its deployment record still exists; network/ACL issues against the Nomad agent; job exists only in a different region than queried.","solutions":["Check the wrapped cause: if 404, the job is gone — use `nomad job list` to confirm","Verify connectivity (NOMAD_ADDR) and that the agent is healthy","Ensure the ACL token has `job:read` (or `read-job`) capability in the relevant namespace/region"],"exampleFix":"// before (shell)\nnomad deployment status <id>  # fails: Error fetching job: job not found\n// after\nnomad job status <job-id>     # confirm job exists first; re-run with correct region/namespace","handlingStrategy":"retry","validationCode":"job, _, err := c.Jobs().Info(jobID, &api.QueryOptions{Region: region})\nif err != nil { return fmt.Errorf(\"job %s unreadable before deployment lookup: %w\", jobID, err) }","typeGuard":null,"tryCatchPattern":"if err := fetchMultiRegionDeployments(c, d); err != nil {\n    if strings.Contains(err.Error(), \"job not found\") {\n        // skip: job GC'd; fall back to deployment-only output\n    } else {\n        // transient network/ACL error: retry with backoff\n    }\n}","preventionTips":["Confirm job exists before inspecting its deployments","Use an ACL token with read-job capability","Retry transient connection errors with backoff"],"tags":["api","network","nomad-jobs"],"backgroundTag":"job-fetch-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"}