hashicorp/nomad · error

missing name

Error message

missing name

What it means

HostVolume.Validate requires a non-empty Name for a host volume. A HostVolume with no name fails validation with the sentinel 'missing name', appended to the multierror after the ID check. This ensures volumes are addressable in the state store and API.

Source

Thrown at nomad/structs/host_volumes.go:142

		CreateIndex:   hv.CreateIndex,
		CreateTime:    hv.CreateTime,
		ModifyIndex:   hv.ModifyIndex,
		ModifyTime:    hv.ModifyTime,
	}, nil
}

// Validate verifies that the submitted HostVolume spec has valid field values,
// without validating any changes or state (see ValidateUpdate).
func (hv *HostVolume) Validate() error {

	var mErr *multierror.Error

	if hv.ID != "" && !helper.IsUUID(hv.ID) {
		mErr = multierror.Append(mErr, fmt.Errorf("invalid ID %q", hv.ID))
	}

	if hv.Name == "" {
		mErr = multierror.Append(mErr, errors.New("missing name"))
	}

	if hv.RequestedCapacityMaxBytes < hv.RequestedCapacityMinBytes {
		mErr = multierror.Append(mErr, fmt.Errorf(
			"capacity_max (%d) must be larger than capacity_min (%d)",
			hv.RequestedCapacityMaxBytes, hv.RequestedCapacityMinBytes))
	}

	for _, cap := range hv.RequestedCapabilities {
		err := cap.Validate()
		if err != nil {
			mErr = multierror.Append(mErr, err)
		}
	}

	for _, constraint := range hv.Constraints {
		if err := constraint.Validate(); err != nil {
			mErr = multierror.Append(mErr, fmt.Errorf("invalid constraint: %v", err))

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set the host volume's name field to a non-empty value
  2. If registering via API/CLI, include the volume name in the request payload
  3. Verify JSON/HCL decoding maps the name field correctly (correct key casing)
  4. Use validation before submission to catch the missing name client-side

Example fix

// before
hv := &structs.HostVolume{
  ID:   "e5f0b1c2-...",
}

// after
hv := &structs.HostVolume{
  ID:   "e5f0b1c2-...",
  Name: "shared-data",
}
Defensive patterns

Strategy: validation

Validate before calling

if hv.Name == "" {
	return errors.New("host volume must have a name")
}

Prevention

When it happens

Trigger: Registering or validating a HostVolume struct (via the host volumes API / validateVolumeUpdate path) where hv.Name == "".

Common situations: Programmatic volume construction forgetting the Name field; partial updates building an empty HostVolume for validation; deserializing a volume spec with a missing or misspelled name key.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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