hashicorp/nomad · error

unable to upsert job into job_version table: %v

Error message

unable to upsert job into job_version table: %v

What it means

UpsertJob failed while persisting the job into the job_version table via s.upsertJobVersion. Nomad keeps every submitted job version in a separate table for history/diffing; a failure here aborts the registration transaction and the job is not stored.

Source

Thrown at nomad/state/state_store.go:1888

			return fmt.Errorf("setting job status for %q failed: %v", job.ID, err)
		}

		// Have to get the job again since it could have been updated
		updated, err := txn.First("jobs", "id", job.Namespace, job.ID)
		if err != nil {
			return fmt.Errorf("job lookup failed: %v", err)
		}
		if updated != nil {
			job = updated.(*structs.Job)
		}
	}

	if err := s.updateSummaryWithJob(index, job, txn); err != nil {
		return fmt.Errorf("unable to create job summary: %v", err)
	}

	if err := s.upsertJobVersion(index, job, txn); err != nil {
		return fmt.Errorf("unable to upsert job into job_version table: %v", err)
	}

	if err := s.updateJobScalingPolicies(index, job, txn); err != nil {
		return fmt.Errorf("unable to update job scaling policies: %v", err)
	}

	if err := s.updateJobRecommendations(index, txn, existingJob, job); err != nil {
		return fmt.Errorf("unable to update job recommendations: %v", err)
	}

	if err := s.updateJobCSIPlugins(index, job, existingJob, txn); err != nil {
		return fmt.Errorf("unable to update job csi plugins: %v", err)
	}

	if err := s.updateJobSubmission(index, sub, job.Namespace, job.ID, job.Version, txn); err != nil {
		return fmt.Errorf("unable to update job submission: %v", err)
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Inspect the wrapped %v cause in server logs
  2. Retry the job submission; the transaction is atomic so no partial versions persist
  3. Verify cluster health and raft snapshot integrity
  4. Upgrade Nomad if the error is reproducible
Defensive patterns

Strategy: retry

Validate before calling

// Ensure the job parses and has a valid ID/Namespace before submit
if err := job.Validate(); len(err) > 0 {
  return fmt.Errorf("invalid job: %v", err)
}

Type guard

func isJobVersionError(err error) bool {
  return err != nil && strings.Contains(err.Error(), "job_version table")
}

Try / catch

_, err := client.Jobs().Register(job, nil, nil, nil)
if isJobVersionError(err) {
  time.Sleep(time.Second)
  _, err = client.Jobs().Register(job, nil, nil, nil)
}
return err

Prevention

When it happens

Trigger: Registering a job where inserting the current job version into the job_version table fails inside the write transaction (memdb insert error, table corruption, internal bug).

Common situations: Seen with long-lived clusters after failed upgrades, or when internal state store invariants break; users observe job register RPC errors.

Related errors


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