grafana/k6 · error

starting test: %w

Error message

starting test: %w

What it means

After a successful upload, `k6 cloud` calls client.StartTest to trigger the run; any failure is wrapped with this message. The test definition exists at this point, so the wrapped error is usually a structured ResponseError explaining why the server refused to start it (quota, configuration, permission) or a transient HTTP/network error.

Source

Thrown at internal/cmd/cloud.go:277

		if err != nil {
			return err
		}
		executionPlan := test.derivedConfig.Scenarios.GetFullExecutionRequirements(et)
		testURL, err := resolveCloudTestURL(cloudConfig.StackURL.String, loadTest.GetId())
		if err != nil {
			return err
		}
		printExecutionDescription(
			c.gs, "cloud", test.sourceRootPath, testURL, test.derivedConfig, et, executionPlan, nil,
		)
		modifyAndPrintBar(c.gs, progressBar, pb.WithConstLeft("Run "), pb.WithConstProgress(1.0, "Archived"))
		c.printTestStatus("Archived")
		return nil
	}

	run, err := client.StartTest(globalCtx, loadTest.GetId())
	if err != nil {
		return fmt.Errorf("starting test: %w", err)
	}
	testRunID := run.GetId()

	// Trap Interrupts, SIGINTs and SIGTERMs.
	gracefulStop := func(sig os.Signal) {
		logger.WithField("sig", sig).Print("Stopping cloud test run in response to signal...")
		// Do this in a separate goroutine so that if it blocks, the
		// second signal can still abort the process execution.
		go func() {
			stopErr := client.StopTest(context.WithoutCancel(globalCtx), testRunID)
			if stopErr != nil {
				logger.WithError(stopErr).Error("Stop cloud test error")
			} else {
				logger.Info("Successfully sent signal to stop the cloud test, now waiting for it to actually stop...")
			}
			globalCancel()
		}()
	}

View on GitHub (pinned to 93accf6570)

Solutions

  1. Inspect the wrapped error text: the server's ResponseError details the refusal reason
  2. Check the project/org quota and plan limits in Grafana Cloud
  3. Simplify script options (scenarios, thresholds) to isolate a rejected setting
  4. Re-authenticate with `k6 cloud login` if permissions changed, then retry

Example fix

# before
k6 cloud script.js  # start rejected: quota exceeded
# after
k6 cloud run --local-execution script.js  # or raise quota / reduce runs
Defensive patterns

Strategy: try-catch

Try / catch

if _, err := client.StartTest(ctx, loadTest.GetId()); err != nil {
    var re cloudapiv6.ResponseError
    if errors.As(err, &re) && re.Response.StatusCode >= 500 {
        // transient: retry starting after backoff; the uploaded test is reusable
    }
    // permanent (quota/permissions): surface the server message and stop
}

Prevention

When it happens

Trigger: StartTest returns non-2xx: cloud test quota exhausted, test definition rejected server-side (invalid scenario/options), token lacks permission to start runs, or a gateway/network failure between upload and start.

Common situations: Hitting the Grafana Cloud test-run or VUh limits on a free plan; options in the script that the cloud runner rejects; org-level permissions changed after login; intermittent 5xx during Cloud incidents.

Related errors


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/709cd9e27c92df97. Report an issue: GitHub.