{"record":{"id":"589e716c9b7a0b47","repo":"hashicorp/nomad","slug":"error-querying-job-summary-s","errorCode":null,"errorMessage":"Error querying job summary: %s","messagePattern":"Error querying job summary: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/job_status.go","lineNumber":735,"sourceCode":"\t\t\t\tmodTimePretty)\n\t\t\tif showDeadline {\n\t\t\t\trow += fmt.Sprintf(\"|%s\", deadlines[i])\n\t\t\t}\n\t\t\tallocs[i+1] = row\n\t\t}\n\t}\n\n\treturn formatList(allocs)\n}\n\n// outputJobSummary displays the given jobs summary and children job summary\n// where appropriate\nfunc (c *JobStatusCommand) outputJobSummary(client *api.Client, job *api.Job) error {\n\t// Query the summary\n\tq := &api.QueryOptions{Namespace: *job.Namespace}\n\tsummary, _, err := client.Jobs().Summary(*job.ID, q)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error querying job summary: %s\", err)\n\t}\n\n\tif summary == nil {\n\t\treturn nil\n\t}\n\n\tperiodic := job.IsPeriodic()\n\tparameterizedJob := job.IsParameterized()\n\n\t// Print the summary\n\tif !periodic && !parameterizedJob {\n\t\tc.Ui.Output(c.Colorize().Color(\"\\n[bold]Summary[reset]\"))\n\t\tsummaries := make([]string, len(summary.Summary)+1)\n\t\tsummaries[0] = \"Task Group|Queued|Starting|Running|Failed|Complete|Lost|Unknown\"\n\t\ttaskGroups := make([]string, 0, len(summary.Summary))\n\t\tfor taskGroup := range summary.Summary {\n\t\t\ttaskGroups = append(taskGroups, taskGroup)\n\t\t}","sourceCodeStart":717,"sourceCodeEnd":753,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/job_status.go#L717-L753","documentation":"Raised by outputJobSummary (used by periodic, parameterized, and normal `nomad job status` output) when Jobs().Summary(jobID, q) fails to fetch the job's summary (queued/running/failed counts per task group). The client error is wrapped into this message and aborts the summary section. It is purely a read-side API failure.","triggerScenarios":"client.Jobs().Summary(*job.ID, q) returns an error: agent unreachable, ACL token without job-summary read permission in the namespace, wrong namespace/region in q, or server 5xx.","commonSituations":"Least-privilege ACL policies that permit job read but omit summary access; periodic/dispatched job inspected from the wrong namespace; network drop or agent restart while paging through status output; leadership failover mid-command.","solutions":["Fix the wrapped cause: connectivity first (curl $NOMAD_ADDR/v1/agent/health), then server errors.","Set the correct namespace/region: nomad job status -namespace <ns> <job>.","Grant the ACL token job/summary read rights in the target namespace and retry.","Retry the command after transient conditions like no cluster leader."],"exampleFix":"// before\nnomad job status web    // Error querying job summary: permission denied\n// after\nnomad acl policy apply -job web-read -namespace default \\\n  'namespace \"default\" { capabilities = [\"list-jobs\", \"read-job\", \"allocations\"] }'\nNOMAD_TOKEN=<web-read-token> nomad job status web","handlingStrategy":"retry","validationCode":"curl -sf -H \"X-Nomad-Token: $NOMAD_TOKEN\" \\\n  \"$NOMAD_ADDR/v1/job/$JOB_ID/summary?namespace=$NOMAD_NAMESPACE\" > /dev/null","typeGuard":null,"tryCatchPattern":"summary, _, err := client.Jobs().Summary(id, q)\nif err != nil {\n    if isTransient(err) { // 5xx / connection reset\n        return retry(3, backoff, func() error { ... })\n    }\n    return err\n}","preventionTips":["Scope automation tokens with read-job capability so summary reads succeed.","Standardize namespace/region env vars in CI and ops scripts.","Health-check the cluster before scheduled status/report jobs.","Degrade gracefully: if summary fails but allocations succeeded, render partial output."],"tags":["nomad","cli","api-client","job-summary"],"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"}