hashicorp/nomad · error
job %q is in nonexistent namespace %q
Error message
job %q is in nonexistent namespace %q
What it means
upsertJobImpl refused to register the job because its namespace does not exist in the state store; jobs can only be upserted into a namespace that has been created.
Source
Thrown at nomad/state/state_store.go:1807
// UpsertJobWithRequest is used to register a job or update a job definition
// using the JobRegisterRequest. It allows flags to be set and used within the
// upsert job action
func (s *StateStore) UpsertJobWithRequest(msgType structs.MessageType, index uint64, req *structs.JobRegisterRequest) error {
txn := s.db.WriteTxnMsgT(msgType, index)
defer txn.Abort()
if err := s.upsertJobImpl(index, req.Submission, req.Job, false, txn, req); err != nil {
return err
}
return txn.Commit()
}
// upsertJobImpl is the implementation for registering a job or updating a job definition
func (s *StateStore) upsertJobImpl(index uint64, sub *structs.JobSubmission, job *structs.Job, keepVersion bool, txn *txn, req *structs.JobRegisterRequest) error {
// Assert the namespace exists
if exists, err := s.namespaceExists(txn, job.Namespace); err != nil {
return err
} else if !exists {
return fmt.Errorf("job %q is in nonexistent namespace %q", job.ID, job.Namespace)
}
// Upgrade path.
// Assert the node pool is set and exists.
if job.NodePool == "" {
job.NodePool = structs.NodePoolDefault
}
if exists, err := s.nodePoolExists(txn, job.NodePool); err != nil {
return err
} else if !exists {
return fmt.Errorf("job %q is in nonexistent node pool %q", job.ID, job.NodePool)
}
// Check if the job already exists
existing, err := txn.First("jobs", "id", job.Namespace, job.ID)
if err != nil {
return fmt.Errorf("job lookup failed: %v", err)
}View on GitHub (pinned to 482b49bf1a)
Solutions
- Create the namespace first (`nomad namespace apply`)
- Register the job into an existing namespace
- Check for typos in the job's namespace field
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at nomad/state/state_store.go:1807 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/460213a021bd034d.
Report an issue: GitHub.