{"record":{"id":"3864e9dc92a4ab7f","repo":"hashicorp/nomad","slug":"error-querying-job-evaluations-s","errorCode":null,"errorMessage":"Error querying job evaluations: %s","messagePattern":"Error querying job evaluations: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/job_status.go","lineNumber":441,"sourceCode":"\n// outputJobInfo prints information about the passed non-periodic job. If a\n// request fails, an error is returned.\nfunc (c *JobStatusCommand) outputJobInfo(client *api.Client, job *api.Job) error {\n\tvar q *api.QueryOptions\n\tif job.Namespace != nil {\n\t\tq = &api.QueryOptions{Namespace: *job.Namespace}\n\t}\n\n\t// Query the allocations\n\tjobAllocs, _, err := client.Jobs().Allocations(*job.ID, c.allAllocs, q)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error querying job allocations: %s\", err)\n\t}\n\n\t// Query the evaluations\n\tjobEvals, _, err := client.Jobs().Evaluations(*job.ID, q)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error querying job evaluations: %s\", err)\n\t}\n\n\tlatestDeployment, _, err := client.Jobs().LatestDeployment(*job.ID, q)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error querying latest job deployment: %s\", err)\n\t}\n\n\tjobActions := make([]map[string]string, 0)\n\tfor _, tg := range job.TaskGroups {\n\t\tfor _, task := range tg.Tasks {\n\t\t\tfor _, action := range task.Actions {\n\t\t\t\tjobActions = append(jobActions, map[string]string{\n\t\t\t\t\t\"group\":  *tg.Name,\n\t\t\t\t\t\"task\":   task.Name,\n\t\t\t\t\t\"action\": action.Name,\n\t\t\t\t})\n\t\t\t}\n\t\t}","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/job_status.go#L423-L459","documentation":"Raised by outputJobInfo when Jobs().Evaluations(jobID, q) fails while collecting evaluation history for the status output. The raw API error is wrapped into this message. Allocations were already fetched successfully at this point, so the failure is specific to the evaluations read (usually permissions or a transient server error).","triggerScenarios":"client.Jobs().Evaluations(*job.ID, q) returns an error: agent unreachable mid-command, ACL token cannot read evaluations in the namespace, namespace/region mismatch in q, or server-side error during the read.","commonSituations":"Fine-grained ACL policy allowing job/alloc reads but not evaluation reads; leadership change on the server between the alloc and eval queries; temporary network blip during a long status command.","solutions":["Check the wrapped cause: if it's permission denied, add evaluation read rights to the ACL policy for the namespace.","Confirm namespace/region flags match the job's scope.","Retry the command if the server just failed over (no cluster leader / 500).","Verify agent connectivity and NOMAD_ADDR if the cause is a connection error."],"exampleFix":"// before (HCL policy missing eval read)\nnamespace \"default\" {\n  job = \"read\"\n}\n// after\nnamespace \"default\" {\n  job       = \"read\"\n  eval      = \"read\"\n  allocation = \"read\"\n}","handlingStrategy":"retry","validationCode":"curl -sf -H \"X-Nomad-Token: $NOMAD_TOKEN\" \\\n  \"$NOMAD_ADDR/v1/job/$JOB_ID/evaluations?namespace=$NOMAD_NAMESPACE\" > /dev/null","typeGuard":null,"tryCatchPattern":"jobEvals, _, err := client.Jobs().Evaluations(id, q)\nif err != nil {\n    if strings.Contains(err.Error(), \"No path to a job\") || isTransient(err) {\n        // retry or adjust namespace\n    }\n    return err\n}","preventionTips":["Include eval = read in least-privilege ACL policies used for status tooling.","Use consistent -namespace/-region across all queries in one command invocation.","Retry reads after server failover events.","Version-pin CLI against the cluster to avoid endpoint drift."],"tags":["nomad","cli","api-client","evaluations"],"backgroundTag":"job-query-failed","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}