hashicorp/nomad · error

failed to parse collection interval: %v

Error message

failed to parse collection interval: %v

What it means

In the device plugin server's Stats handler, the collection interval sent by the client could not be parsed as a protobuf duration, so device stats streaming cannot be paced.

Source

Thrown at plugins/device/server.go:81

	if err != nil {
		return nil, err
	}

	// Make the response
	presp := &proto.ReserveResponse{
		ContainerRes: convertStructContainerReservation(resp),
	}

	return presp, nil
}

func (d *devicePluginServer) Stats(req *proto.StatsRequest, stream proto.DevicePlugin_StatsServer) error {
	ctx := stream.Context()

	// Retrieve the collection interval
	interval, err := ptypes.Duration(req.CollectionInterval)
	if err != nil {
		return fmt.Errorf("failed to parse collection interval: %v", err)
	}

	// Default the duration if we get an invalid duration
	if interval.Nanoseconds() == 0 {
		interval = time.Second
	}

	outCh, err := d.impl.Stats(ctx, interval)
	if err != nil {
		return err
	}

	for {
		select {
		case <-ctx.Done():
			return nil
		case resp, ok := <-outCh:
			// The output channel has been closed, end the stream

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Ensure the client sends a valid protobuf duration for the collection interval
  2. Update mismatched client/plugin proto definitions
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at plugins/device/server.go:81 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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