hashicorp/nomad · error

device name must be specified

Error message

device name must be specified

What it means

Appended by DeviceGroup.Validate() when the group's Name is empty. Together with vendor and type, Name forms the unique device group identifier used in scheduling and resource accounting, so it must be non-empty.

Source

Thrown at plugins/device/device.go:98

	// Devices is the set of device instances.
	Devices []*Device

	// Attributes are a set of attributes shared for all the devices.
	Attributes map[string]*structs.Attribute
}

// Validate validates that the device group is valid
func (d *DeviceGroup) Validate() error {
	var mErr multierror.Error

	if d.Vendor == "" {
		_ = multierror.Append(&mErr, fmt.Errorf("device vendor must be specified"))
	}
	if d.Type == "" {
		_ = multierror.Append(&mErr, fmt.Errorf("device type must be specified"))
	}
	if d.Name == "" {
		_ = multierror.Append(&mErr, fmt.Errorf("device name must be specified"))
	}

	for i, dev := range d.Devices {
		if dev == nil {
			_ = multierror.Append(&mErr, fmt.Errorf("device %d is nil", i))
			continue
		}

		if err := dev.Validate(); err != nil {
			_ = multierror.Append(&mErr, multierror.Prefix(err, fmt.Sprintf("device %d: ", i)))
		}
	}

	for k, v := range d.Attributes {
		if err := v.Validate(); err != nil {
			_ = multierror.Append(&mErr, fmt.Errorf("device attribute %q invalid: %v", k, err))
		}
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set DeviceGroup.Name in the plugin to a stable identifier for the group (e.g. "k80", "a100") and redeploy
  2. Provide the missing group-name value in the plugin's client configuration
  3. Validate the DeviceGroup in the plugin before returning it from Fingerprint so the error surfaces at plugin startup

Example fix

// before
&device.DeviceGroup{Vendor: "nvidia", Type: device.DeviceTypeGPU}
// after
&device.DeviceGroup{Vendor: "nvidia", Type: device.DeviceTypeGPU, Name: "a100"}
Defensive patterns

Strategy: validation

Validate before calling

// Go: guard before returning a DeviceGroup
if g.Name == "" {
    return nil, fmt.Errorf("device group %s/%s missing name", g.Vendor, g.Type)
}

Prevention

When it happens

Trigger: A DeviceGroup produced during fingerprinting has Name == "" when Validate() runs — e.g. the plugin did not derive a device group name from its config or detected hardware.

Common situations: Custom device plugin leaving Name unset; config key controlling the group name missing; renamed struct fields in a plugin update.

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/37ea1cd7f5dc0db4. Report an issue: GitHub.