hashicorp/nomad · warning

devices updates already batched

Error message

devices updates already batched

What it means

batchDevicesUpdates registers the one-shot callback that flushes batched device node updates, guarded by devicesBatched under devicesMu. This error means the method was called a second time on the same batchNodeUpdates instance, which supports a single device fingerprint flush at client start.

Source

Thrown at client/node_updater.go:505

// used in the device manager to send device fingerprints to
func (b *batchNodeUpdates) updateNodeFromDevices(devices []*structs.NodeDeviceResource) {
	b.devicesMu.Lock()
	defer b.devicesMu.Unlock()
	if b.devicesBatched {
		b.devicesCB(devices)
		return
	}

	b.devices = devices
}

// batchDevicesUpdates sends the batched device node updates by calling f with
// the devices
func (b *batchNodeUpdates) batchDevicesUpdates(f devicemanager.UpdateNodeDevicesFn) error {
	b.devicesMu.Lock()
	defer b.devicesMu.Unlock()
	if b.devicesBatched {
		return fmt.Errorf("devices updates already batched")
	}

	b.devicesBatched = true
	f(b.devices)
	return nil
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Call batchDevicesUpdates exactly once per batchNodeUpdates instance
  2. Construct a new batchNodeUpdates for each round that needs device batching
  3. Restructure restart paths so batching is only performed on the initial fingerprint round

Example fix

// before: batching devices twice on shared batcher
b.batchDevicesUpdates(fn)
b.batchDevicesUpdates(fn) // -> "devices updates already batched"

// after: guard with fresh instance or flag
if !b.devicesBatched {
    b.batchDevicesUpdates(fn)
} else {
    b = newBatchNodeUpdates()
    b.batchDevicesUpdates(fn)
}
Defensive patterns

Strategy: try-catch

Validate before calling

if b.devicesBatched {
	return nil // devices already flushed/registered
}

Try / catch

if err := b.batchDevicesUpdates(fn); err != nil {
	if err.Error() == "devices updates already batched" {
		logger.Debug("devices batch already registered; ignoring")
		return nil
	}
	return err
}

Prevention

When it happens

Trigger: Calling batchNodeUpdates.batchDevicesUpdates (directly or via batchFirstFingerprints) more than once on the same batcher instance.

Common situations: Re-running the startup batching sequence after a fingerprint restart or reconnect; duplicated device fingerprinter setup; test suites reusing a single batchNodeUpdates across cases.

Related errors


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