hashicorp/nomad · error

device %d is nil

Error message

device %d is nil

What it means

DeviceGroup validation guard: a nil entry appears in the group's Devices list. Plugin-supplied fingerprint data contained a null device instance, which the loop detects and skips rather than dereferencing.

Source

Thrown at plugins/device/device.go:103

}

// 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))
		}
	}

	return mErr.ErrorOrNil()

}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Fix the device plugin to omit nil entries from its device list
  2. Filter null devices out of the fingerprint response before validation
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at plugins/device/device.go:103 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/18b18c2dda57d728. Report an issue: GitHub.