grafana/k6 · error

max allowed number of time series in a single batch must be

Error message

max allowed number of time series in a single batch must be a positive number but is %d

What it means

The cloud output's maxTimeSeriesInBatch setting (K6_CLOUD_MAX_TIME_SERIES_IN_BATCH or options.cloud) is below 1. newOutput validates this batching limit because at least one time series per batch is required for metric shipping.

Source

Thrown at internal/output/cloud/output.go:187

		conf.Name = null.StringFrom(filepath.Base(scriptPath))
	}
	if conf.Name.String == "-" {
		conf.Name = null.StringFrom(defaultTestName)
	}

	duration, testEnds := lib.GetEndOffset(params.ExecutionPlan)
	if !testEnds {
		return nil, errors.New("tests with unspecified duration are not allowed when outputting data to k6 cloud")
	}

	if conf.MetricPushConcurrency.Int64 < 1 {
		return nil, fmt.Errorf("metrics push concurrency must be a positive number but is %d",
			conf.MetricPushConcurrency.Int64)
	}

	if conf.MaxTimeSeriesInBatch.Int64 < 1 {
		return nil, fmt.Errorf("max allowed number of time series in a single batch must be a positive number but is %d",
			conf.MaxTimeSeriesInBatch.Int64)
	}

	apiClient := cloudapi.NewClient(
		logger, conf.Token.String, conf.Host.String, build.Version, conf.Timeout.TimeDuration())

	return &Output{
		config:        conf,
		client:        apiClient,
		executionPlan: params.ExecutionPlan,
		duration:      int64(duration / time.Second),
		logger:        logger,
		usage:         params.Usage,
		testRunID:     params.RuntimeOptions.Env[testRunIDKey],
	}, nil
}

// validateRequiredSystemTags checks if all required tags are present.

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Set maxTimeSeriesInBatch to a positive integer
  2. Remove the setting to fall back to the default batch size
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/output/cloud/output.go:187 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/23d262e04e8c7c15. Report an issue: GitHub.