grafana/k6 · error

test run aborted before starting

Error message

test run aborted before starting

What it means

Returned by Client.WaitForTestRunReady (internal/cloudapi/provisioning/api.go:164) when the test run reached status 'aborted' before 'initializing' but no aborted entry in status_history carried a message, so there is nothing to append. It is the same terminal condition as the %s variant, just with an unhelpfully silent backend history. The run cannot proceed; k6 stops before local execution begins.

Solutions

  1. Open the test run page in Grafana Cloud (its URL/ID appears earlier in the k6 output) — the UI timeline usually shows more than the API message field.
  2. Check org quotas/billing anyway; silent aborts are frequently quota/limit automation.
  3. Retry the run once — if it aborts silently again at the same stage, gather the test run ID and report it to k6 Cloud support.
  4. Verify with collaborators that nobody aborted the run from the UI.
Defensive patterns

Strategy: try-catch

Try / catch

if err := c.WaitForTestRunReady(ctx, testRunID, poll); err != nil {
	if err.Error() == "test run aborted before starting" {
		// no backend message — inspect the run in the UI by ID before assuming a bug
		log.Warnf("run %d aborted with no message; check the project dashboard", testRunID)
	}
	return err
}

Prevention

When it happens

Trigger: Backend flips the run to 'aborted' with empty history messages — automatic aborts (internal scheduler decisions, timeouts in the queue pipeline) often record no human-readable message, unlike user-initiated or policy aborts.

Common situations: Backend-side automation aborting stale queued runs; status propagation races where the abort entry is written without a message field; older cloud API versions that did not populate messages.

Related errors


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

Appendix: 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 01ffac6f24)