{"record":{"id":"e298da8d4b7975ab","repo":"hashicorp/nomad","slug":"error-fetching-deployments-for-job-s-v","errorCode":null,"errorMessage":"Error fetching deployments for job %s: %v","messagePattern":"Error fetching deployments for job (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/deployment_status.go","lineNumber":636,"sourceCode":"\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\n\n\t}\n\treturn results, nil\n}\n\nfunc fetchRegionDeployment(c *api.Client, d *api.Deployment, region *api.MultiregionRegion) (*api.Deployment, error) {\n\tif region == nil {\n\t\treturn nil, errors.New(\"Region not found\")\n\t}\n\n\topts := &api.QueryOptions{Region: region.Name}\n\tdeploys, _, err := c.Jobs().Deployments(d.JobID, false, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error fetching deployments for job %s: %v\", d.JobID, err)\n\t}\n\tfor _, dep := range deploys {\n\t\tif dep.JobVersion == d.JobVersion {\n\t\t\treturn dep, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"Could not find job version %d for region\", d.JobVersion)\n}\n\nfunc formatMultiregionDeployment(regions map[string]*api.Deployment, uuidLength int) string {\n\trowString := \"Region|ID|Status\"\n\trows := make([]string, len(regions)+1)\n\trows[0] = rowString\n\ti := 1\n\tfor k, v := range regions {\n\t\trow := fmt.Sprintf(\"%s|%s|%s\", k, limit(v.ID, uuidLength), v.Status)\n\t\trows[i] = row\n\t\ti++","sourceCodeStart":618,"sourceCodeEnd":654,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/deployment_status.go#L618-L654","documentation":"fetchRegionDeployment queries c.Jobs().Deployments for the job in a specific region. Any transport/API error from that call is wrapped as \"Error fetching deployments for job %s: %v\", keeping the job ID for context.","triggerScenarios":"The goroutine spawned per multiregion region calls Jobs().Deployments with opts.Region set and the API errors: unreachable remote region (federation), ACL denial, or RPC timeout.","commonSituations":"A region in job.Multiregion is unhealthy or not federated; ACL token lacks deployment read in that region; intermittent network partition between regions.","solutions":["Inspect the wrapped cause — for connection errors check that region's agent availability/federation","Verify the ACL token grants read access in every region the job targets","Retry the command once the region is reachable; check `nomad server members` for that region"],"exampleFix":"// before\n// region 'west' not federated -> Error fetching deployments for job example: dial tcp ...: refuse\n// after\nnomad server members -region=west   # confirm region health, fix federation, retry","handlingStrategy":"retry","validationCode":"opts := &api.QueryOptions{Region: region.Name}\nif _, _, err := c.Agent().Regions(); err != nil {\n    return fmt.Errorf(\"region %s not reachable: %w\", region.Name, err)\n}","typeGuard":null,"tryCatchPattern":"deploys, _, err := c.Jobs().Deployments(d.JobID, false, opts)\nif err != nil {\n    // transient region error: retry with backoff, then surface region name\n    return nil, retryOrWrap(err, \"region \"+region.Name)\n}","preventionTips":["Monitor federation/peering health of all job regions","Use ACL tokens valid across federated regions","Set sane API timeouts and retry per-region failures"],"tags":["api","network","multiregion","nomad-deployments"],"backgroundTag":"region-unreachable","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"}