hashicorp/nomad · error

invalid request of zero devices

Error message

invalid request of zero devices

What it means

deviceAllocator.createOffer: the requested device count (ask.Count) is zero. Zero-count device requests are invalid — the block should be omitted entirely rather than asking for no devices.

Source

Thrown at scheduler/feasible/device.go:112

					}
				}
			}
		}
	}

	return false
}

// createOffer takes a device request and returns an assignment as well as a
// score for the assignment. If no assignment is possible, an error is
// returned explaining why.
func (d *deviceAllocator) createOffer(mem *memoryNodeMatcher, ask *structs.RequestedDevice) (out *structs.AllocatedDeviceResource, score float64, err error) {
	// Try to hot path
	if len(d.Devices) == 0 {
		return nil, 0.0, fmt.Errorf("no devices available")
	}
	if ask.Count == 0 {
		return nil, 0.0, fmt.Errorf("invalid request of zero devices")
	}

	// Hold the current best offer
	var offer *structs.AllocatedDeviceResource
	var offerScore float64
	var matchedWeights float64

	// Determine the devices that are feasible based on availability and
	// constraints
	for id, devInst := range d.Devices {
		// Check if the device works
		if !nodeDeviceMatches(d.ctx, devInst.Device, ask) {
			continue
		}

		// Check if we have enough unused instances to use this
		assignable := []string{}
		for instanceID, v := range devInst.Instances {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set the device request count to at least 1
  2. Remove the device block from the task resources
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at scheduler/feasible/device.go:112 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/7795df6eb47c1309. Report an issue: GitHub.