hashicorp/nomad · error
Failed to retrieve evaluations for job %q: %w
Error message
Failed to retrieve evaluations for job %q: %w
What it means
monitorPlacementFailures polls Jobs().Evaluations for the job to detect placement failures while waiting for a replacement alloc. If the polling RPC fails, the error is written to errCh as 'Failed to retrieve evaluations for job <id>: <cause>' and the monitor exits.
Source
Thrown at command/job_restart.go:1023
// Returns an error in errCh if anything goes wrong or if there are placement
// failures for the allocation task group.
func (c *JobRestartCommand) monitorPlacementFailures(
ctx context.Context,
alloc AllocationListStubWithJob,
index uint64,
errCh chan<- error,
) {
q := &api.QueryOptions{WaitIndex: index}
for {
select {
case <-ctx.Done():
return
default:
}
evals, qm, err := c.client.Jobs().Evaluations(alloc.JobID, q)
if err != nil {
errCh <- fmt.Errorf("Failed to retrieve evaluations for job %q: %w", alloc.JobID, err)
return
}
for _, eval := range evals {
select {
case <-ctx.Done():
return
default:
}
// Skip evaluations created before the allocation was stopped or
// that are not blocked.
if eval.CreateIndex < index || eval.Status != api.EvalStatusBlocked {
continue
}
failures := eval.FailedTGAllocs[alloc.TaskGroup]
if failures != nil {View on GitHub (pinned to 482b49bf1a)
Solutions
- Check Nomad agent health and network connectivity, then re-run the restart
- Verify the ACL token can read job evaluations
- Increase query timeouts/waits if the RPC is timing out
- Confirm the job was not deleted concurrently
Defensive patterns
Strategy: retry
Validate before calling
if _, _, err := client.Jobs().Evaluations(jobID, nil); err != nil {
return fmt.Errorf("cannot poll evaluations for %s: %w", jobID, err)
} Try / catch
evals, qm, err := client.Jobs().Evaluations(jobID, q)
if err != nil {
if isTransient(err) {
time.Sleep(pollInterval)
continue // bounded retries
}
errCh <- fmt.Errorf("eval polling aborted: %w", err)
return
} Prevention
- Use bounded retries with backoff on evaluation polling
- Keep the agent reachable for the duration of the restart
- Ensure the ACL token can read job evaluations
- Avoid deleting the job while a restart is in flight
When it happens
Trigger: Repeated Evaluations API calls fail — agent goes away mid-restart, request timeout (query options), ACL token lacks job read permissions, or job ID no longer exists.
Common situations: Long-running restart spanning an agent restart or deployment; network flakiness between CLI and server; token revoked mid-operation.
Related errors
- error retrieving supported Envoy versions from Consul: %w
- Failed evaluate job: %w
- network namespace already exists but was misconfigured
- network already configured but not found in state
- no CNI network config found
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/3c6693261f563104.
Report an issue: GitHub.