hashicorp/nomad · error

host volume %s is in nonexistent namespace %s

Error message

host volume %s is in nonexistent namespace %s

What it means

UpsertHostVolume refused the write because the volume's namespace does not exist in the state store; host volumes can only be created in an existing namespace.

Source

Thrown at nomad/state/state_store_host_volumes.go:62

		for _, volReq := range alloc.Job.LookupTaskGroup(alloc.TaskGroup).Volumes {
			if vol.MatchesRequestSource(volReq, alloc) {
				vol.Allocations = append(vol.Allocations, alloc.Stub(nil))
			}
		}
	}

	return vol, nil
}

// UpsertHostVolume upserts a host volume
func (s *StateStore) UpsertHostVolume(index uint64, vol *structs.HostVolume) error {
	txn := s.db.WriteTxnMsgT(structs.HostVolumeRegisterRequestType, index)
	defer txn.Abort()

	if exists, err := s.namespaceExists(txn, vol.Namespace); err != nil {
		return err
	} else if !exists {
		return fmt.Errorf("host volume %s is in nonexistent namespace %s", vol.ID, vol.Namespace)
	}

	obj, err := txn.First(TableHostVolumes, indexID, vol.Namespace, vol.ID)
	if err != nil {
		return err
	}
	var old *structs.HostVolume
	if obj != nil {
		old = obj.(*structs.HostVolume)
		vol.CreateIndex = old.CreateIndex
		vol.CreateTime = old.CreateTime
	} else {
		vol.CreateIndex = index
	}

	err = s.enforceHostVolumeQuotaTxn(txn, index, vol, old, true)
	if err != nil {
		return err

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Create the namespace first
  2. Use an existing namespace for the volume
  3. Check for typos in the volume's namespace field
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nomad/state/state_store_host_volumes.go:62 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/bf6a85f187fbb8af. Report an issue: GitHub.