hashicorp/nomad · error

failed to parse collection interval: %v

Error message

failed to parse collection interval: %v

What it means

Returned by the driver plugin server's TaskStats handler when ptypes.Duration fails to decode the collection interval from the TaskStatsRequest. Stats streaming cannot be paced without a valid interval.

Source

Thrown at plugins/drivers/server.go:263

			pbNet.PortMap[k] = int32(v)
		}
	}

	resp := &proto.InspectTaskResponse{
		Task: protoStatus,
		Driver: &proto.TaskDriverStatus{
			Attributes: status.DriverAttributes,
		},
		NetworkOverride: pbNet,
	}

	return resp, nil
}

func (b *driverPluginServer) TaskStats(req *proto.TaskStatsRequest, srv proto.Driver_TaskStatsServer) error {
	interval, err := ptypes.Duration(req.CollectionInterval)
	if err != nil {
		return fmt.Errorf("failed to parse collection interval: %v", err)
	}

	ch, err := b.impl.TaskStats(srv.Context(), req.TaskId, interval)
	if err != nil {
		if rec, ok := err.(structs.Recoverable); ok {
			st := status.New(codes.FailedPrecondition, rec.Error())
			st, err := st.WithDetails(&sproto.RecoverableError{Recoverable: rec.IsRecoverable()})
			if err != nil {
				// If this error, it will always error
				panic(err)
			}
			return st.Err()
		}
		return err
	}

	for stats := range ch {
		pb, err := TaskStatsToProto(stats)

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Send a valid protobuf duration as the collection interval
  2. Align client and driver proto definitions
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at plugins/drivers/server.go:263 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/9dd070164b79f192. Report an issue: GitHub.