hashicorp/nomad · error

failed to annotate job diff: %v

Error message

failed to annotate job diff: %v

What it means

Fires in Job.Plan when scheduler.Annotate fails to attach scheduler annotations (in-place updates, destructive changes) to the computed job diff; the plan run itself succeeded but its human-readable diff could not be produced.

Source

Thrown at nomad/job_endpoint.go:1918

	}

	if err := sched.Process(eval); err != nil {
		return err
	}

	// Annotate and store the diff
	if plans := len(planner.Plans); plans != 1 {
		return fmt.Errorf("scheduler resulted in an unexpected number of plans: %v", plans)
	}
	annotations := planner.Plans[0].Annotations
	if args.Diff {
		jobDiff, err := existingJob.Diff(args.Job, true)
		if err != nil {
			return fmt.Errorf("failed to create job diff: %v", err)
		}

		if err := scheduler.Annotate(jobDiff, annotations); err != nil {
			return fmt.Errorf("failed to annotate job diff: %v", err)
		}
		reply.Diff = jobDiff
	}

	// Grab the failures
	if len(planner.Evals) != 1 {
		return fmt.Errorf("scheduler resulted in an unexpected number of eval updates: %v", planner.Evals)
	}
	updatedEval := planner.Evals[0]

	// If it is a periodic job calculate the next launch
	if args.Job.IsPeriodic() && args.Job.Periodic.Enabled {
		reply.NextPeriodicLaunch, err = args.Job.Periodic.Next(time.Now().In(args.Job.Periodic.GetLocation()))
		if err != nil {
			return fmt.Errorf("Failed to parse cron expression: %v", err)
		}
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Retry the job plan request
  2. Report persistent failures with the job spec, as annotation depends on diff shape
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at nomad/job_endpoint.go:1918 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/93192668dffbaa3a. Report an issue: GitHub.