hashicorp/nomad · error

job %q is in nonexistent node pool %q

Error message

job %q is in nonexistent node pool %q

What it means

The job endpoint validation hook verifies that every job references an existing node pool. It looks the pool up in state via NodePoolByName; if the lookup succeeds but returns nil, the job's cluster/nodes pool does not exist and registration is rejected.

Source

Thrown at nomad/job_endpoint_hook_node_pool.go:30

// jobNodePoolValidatingHook is an admission hook that ensures the job has valid
// node pool configuration.
type jobNodePoolValidatingHook struct {
	srv *Server
}

func (j jobNodePoolValidatingHook) Name() string {
	return "node-pool-validation"
}

func (j jobNodePoolValidatingHook) Validate(job *structs.Job) ([]error, error) {
	poolName := job.NodePool

	pool, err := j.srv.State().NodePoolByName(nil, poolName)
	if err != nil {
		return nil, err
	}
	if pool == nil {
		return nil, fmt.Errorf("job %q is in nonexistent node pool %q", job.ID, poolName)
	}

	return j.enterpriseValidation(job, pool)
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Create the node pool first: nomad node pool apply <name> (or the NodePools API), then submit the job.
  2. Fix the node_pool value in the job to an existing pool (nomad node pool list).
  3. If the job should run in the default pool, remove the node_pool stanza so it defaults to "default".

Example fix

// before
job "web" {
  node_pool = "prod-eu" # does not exist
}
// after
# create it first: nomad node pool apply prod-eu
job "web" {
  node_pool = "prod-eu"
}
Defensive patterns

Strategy: validation

Validate before calling

// before submitting
pools, _, err := client.NodePools().List(nil)
if err != nil { return err }
want := job.TaskGroups[0].NodePool // or job-level node_pool
found := false
for _, p := range pools {
  if p.Name == want { found = true }
}
if !found { return fmt.Errorf("node pool %q not found; create it with `nomad node pool apply %s`", want, want) }

Type guard

func nodePoolExists(pools []*api.NodePool, name string) bool {
	for _, p := range pools {
		if p.Name == name {
			return true
		}
	}
	return false
}

Try / catch

// golang
_, _, err := client.Jobs().Register(job, nil)
if err != nil && strings.Contains(err.Error(), "nonexistent node pool") {
	// create the pool then retry once
}
// nomad CLI: check `nomad node pool list` before `nomad job run`

Prevention

When it happens

Trigger: Calling the Job.Register/Validate API (or nomad job run) with a job whose node pool (job { node_pool = "..." }) names a pool that has not been created via the NodePools API.

Common situations: Typo in node_pool name; applying a job before the node pool Terraform/API provisioning; copying jobs between clusters where the target cluster lacks the pool; enterprise multi-cluster deployments where one cluster has the pool and another doesn't.

Related errors


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