grafana/k6 · error

test run aborted before starting

Error message

test run aborted before starting

What it means

Identical state machine to the messaged variant: the provisioned test run reached 'aborted' before 'initializing', but no entry in status history carried a message (internal/cloudapi/provisioning/api.go:164), so k6 can only report the bare fact. The abort happened backend-side (API-triggered aborts and some internal aborts leave no message), and the reason must be retrieved out-of-band.

Source

Thrown at internal/cloudapi/provisioning/api.go:164

		status := progress.Status.String()

		switch v6.Status(status) {
		case v6.StatusInitializing:
			return nil

		case v6.StatusAborted:
			var abortMsg string
			for _, e := range progress.StatusHistory {
				if e.Status == v6.StatusAborted && e.Message != "" {
					abortMsg = e.Message
					break
				}
			}
			if abortMsg != "" {
				return fmt.Errorf("test run aborted before starting: %s", abortMsg)
			}
			return fmt.Errorf("test run aborted before starting")

		case v6.StatusCompleted:
			return fmt.Errorf("test run completed before k6 could start")

		default:
			// created, queued, or any unrecognised state — keep polling.
			if status != lastStatus {
				c.logger.WithField("status", progress.FormatStatus()).Debug("test status")
				lastStatus = status
			}
		}

		select {
		case <-ctx.Done():
			return ctx.Err()
		case <-time.After(pollInterval):
			// continue polling
		}

View on GitHub (pinned to 93accf6570)

Solutions

  1. Open the test run page in Grafana Cloud k6 - the TestRunDetailsPageURL returned at provisioning points at it - and read the status timeline
  2. Query GET /cloud/v6/test_runs/{id} yourself and inspect status_history for context
  3. Re-run the test; if aborts recur with no message, check the Grafana Cloud status page and contact support with the run ID
Defensive patterns

Strategy: fallback

Try / catch

if err := client.WaitForTestRunReady(ctx, id, 0); err != nil {
    if err.Error() == "test run aborted before starting" {
        // no message recorded: fall back to out-of-band inspection -
        // GET /cloud/v6/test_runs/{id} status_history, or the run page URL
        // returned at provisioning - before deciding next steps
    }
}

Prevention

When it happens

Trigger: The run aborted via the cloud API without a human-readable reason; backend-internal aborts (scheduling failures, maintenance) that record no message; status history not yet propagated when k6 polled.

Common situations: Automation aborting runs by ID; org-level operations cancelling in-flight provisioning; backend incidents.

Related errors


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