hashicorp/nomad · error

invalid ID %q

Error message

invalid ID %q

What it means

HostVolume.Validate found a non-empty ID that is not a UUID; when supplied, a host volume's ID must be a valid UUIDv4.

Source

Thrown at nomad/structs/host_volumes.go:138

		NodePool:      hv.NodePool,
		NodeID:        hv.NodeID,
		CapacityBytes: hv.CapacityBytes,
		State:         hv.State,
		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)
		}
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Omit the ID to let Nomad generate one
  2. Supply a valid UUID for the volume ID

Example fix

// before
id = "web-vol"
// after
id = "8b1f3a2c-4d5e-6f70-8a9b-0c1d2e3f4a5b"
Defensive patterns

Strategy: validation

Validate before calling

if hv.ID != "" && !helper.IsUUID(hv.ID) {
  return fmt.Errorf("id must be a UUID, got %q", hv.ID)
}

Type guard

func validVolumeID(id string) bool { return id == "" || helper.IsUUID(id) }

Try / catch

if err := hv.Validate(); err != nil {
  return fmt.Errorf("host volume rejected: %w", err)
}

Prevention

When it happens

Trigger: Creating or updating a host volume whose ID is a non-UUID string (e.g. a human-readable name like 'web-vol') instead of a generated UUID.

Common situations: Hand-writing volume definitions and putting the volume name in the id field, importing volumes from another system with non-UUID IDs, or truncated IDs from copy-paste.

Related errors


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