grafana/k6 · error

test run aborted before starting

Error message

test run aborted before starting: %s

What it means

Returned by Client.WaitForTestRunReady (internal/cloudapi/provisioning/api.go:162) when the polled test run reaches status 'aborted' before ever becoming 'initializing', and the status_history contains an aborted entry with a non-empty message. The %s is that backend message: it is the cloud side telling you why the run was killed while queued/created (quota, limits, manual abort, validation). This is a terminal condition — polling stops immediately.

Solutions

  1. Read the message after the colon — it is verbatim from the cloud status_history and names the actual cause (e.g. 'quota exceeded').
  2. Check the org's usage/quotas and billing state in Grafana Cloud; increase limits or wait for the window to reset.
  3. Open the test run's page (URL printed earlier in the log) and inspect its event timeline for who/what aborted it.
  4. If the message is opaque, capture the test run ID and contact k6 Cloud support with it.
Defensive patterns

Strategy: try-catch

Try / catch

if err := c.WaitForTestRunReady(ctx, testRunID, poll); err != nil {
	var abortMsg string
	if strings.HasPrefix(err.Error(), "test run aborted before starting: ") {
		abortMsg = strings.TrimPrefix(err.Error(), "test run aborted before starting: ")
		// surface to CI as a quota/policy failure, not a code bug
		return fmt.Errorf("cloud aborted the queued run: %s", abortMsg)
	}
	return err
}

Prevention

When it happens

Trigger: Cloud-side abort of a queued run: organization monthly VU-hours or test-run quota exceeded, credit/billing limit hit, a user clicking Abort in the Grafana Cloud UI before execution started, or backend-side validation rejecting the configuration.

Common situations: CI runs burning the last of a free-tier quota; billing hold on the org; a teammate aborting what looked like a stuck queued run; peak-hour queue backlog followed by a policy abort.

Related errors


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

Appendix: source

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

			return fmt.Errorf("fetching test status: %w", err)
		}

		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):

View on GitHub (pinned to 01ffac6f24)