grafana/k6 · error

v%d is an unexpected version

Error message

v%d is an unexpected version

What it means

startVersionedOutput switched on the configured cloud API version and hit the default case: the value of K6_CLOUD_API_VERSION (options.cloud.apiVersion) is neither 1 nor 2, so no versioned output implementation exists. (v1 is handled separately with an explicit not-supported error.)

Source

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

	switch out.config.APIVersion.Int64 {
	case int64(apiVersion1):
		err = errors.New("v1 is not supported anymore")
	case int64(apiVersion2):
		out.versionedOutput, err = cloudv2.New(out.logger, out.config, nil)
		if err != nil {
			break
		}

		// Inject provisioning overrides if in provisioning mode.
		if out.provisioningMode {
			if v, ok := out.versionedOutput.(*cloudv2.Output); ok {
				v.SetMetricsHTTPClient(out.metricsPusher)
				v.SetMetricsURL(out.config.MetricsPushURL.String)
			}
		}
	default:
		err = fmt.Errorf("v%d is an unexpected version", out.config.APIVersion.Int64)
	}

	if err != nil {
		return err
	}

	out.SetTestRunID(out.testRunID)
	out.versionedOutput.SetTestRunStopCallback(out.testStopFunc)
	return out.versionedOutput.Start()
}

// lazyInitProvisioning constructs the provisioning-mode dependencies
// (metrics-push HTTP client and provisioning notifier) when they haven't
// been injected already. Tests inject mocks via field assignment before
// calling Start.
func (out *Output) lazyInitProvisioning() error {
	// Lazy-construct the metrics-push HTTP client if not already injected
	// (tests inject mocks via field assignment).

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Set K6_CLOUD_API_VERSION=2 (v1 is no longer supported)
  2. Remove the invalid apiVersion option so the default version is used
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/output/cloud/output.go:504 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/3b0d8977f5436a62. Report an issue: GitHub.