{"record":{"id":"031a0fdd49103a9c","repo":"grafana/k6","slug":"test-run-aborted-before-starting-s","errorCode":null,"errorMessage":"test run aborted before starting: %s","messagePattern":"test run aborted before starting: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloudapi/provisioning/api.go","lineNumber":162,"sourceCode":"\t\t\treturn fmt.Errorf(\"fetching test status: %w\", err)\n\t\t}\n\n\t\tstatus := progress.Status.String()\n\n\t\tswitch v6.Status(status) {\n\t\tcase v6.StatusInitializing:\n\t\t\treturn nil\n\n\t\tcase v6.StatusAborted:\n\t\t\tvar abortMsg string\n\t\t\tfor _, e := range progress.StatusHistory {\n\t\t\t\tif e.Status == v6.StatusAborted && e.Message != \"\" {\n\t\t\t\t\tabortMsg = e.Message\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif abortMsg != \"\" {\n\t\t\t\treturn fmt.Errorf(\"test run aborted before starting: %s\", abortMsg)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"test run aborted before starting\")\n\n\t\tcase v6.StatusCompleted:\n\t\t\treturn fmt.Errorf(\"test run completed before k6 could start\")\n\n\t\tdefault:\n\t\t\t// created, queued, or any unrecognised state — keep polling.\n\t\t\tif status != lastStatus {\n\t\t\t\tc.logger.WithField(\"status\", progress.FormatStatus()).Debug(\"test status\")\n\t\t\t\tlastStatus = status\n\t\t\t}\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-time.After(pollInterval):","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cloudapi/provisioning/api.go#L144-L180","documentation":"While WaitForTestRunReady polls, a transition to status 'aborted' (internal/cloudapi/provisioning/api.go:154-163) means the cloud backend aborted the run before k6 could start executing locally. The code scans status history for the most recent abort message and includes it, so the suffix (e.g. 'VUh quota exceeded', 'test validation failed', 'aborted by user') is the backend's own reason.","triggerScenarios":"Cloud-side validation rejecting the submitted options; organization quota/plan limits (max VUs, VUh budget) exceeded at provisioning time; a user or automation aborting the run from the Grafana Cloud k6 UI while it was still queued; org policy blocking the test.","commonSituations":"Scaling a test up past the plan's limits; a first run in an org with no remaining VUh allowance; someone clicking Stop/Abort on a queued run they thought was stuck.","solutions":["Act on the quoted message: quota-related -> raise the plan/limits or reduce MaxVUs/duration; validation -> fix the reported option; user abort -> coordinate","Open the test run page in Grafana Cloud k6 (the URL returned at provisioning) for the full abort history","Re-run once the underlying cause is addressed - a new run is required, the aborted one cannot be resumed"],"exampleFix":"# before - exceeding plan limits\nexport K6_VUS=5000   # plan allows 500\nk6 cloud run --local-execution script.js   # aborted: VUh quota exceeded\n\n# after\nexport K6_VUS=500\nk6 cloud run --local-execution script.js","handlingStrategy":"validation","validationCode":"# before scaling up, check the message the run will be judged on\n# keep requested VUs/duration inside the org's plan limits\npython3 - <<'EOF'\nimport os\nvus, dur_s = int(os.environ.get('K6_VUS', '1')), int(os.environ.get('K6_DURATION_S', '60'))\nassert vus * dur_s <= int(os.environ.get('ORG_MAX_VUH', '500')) * 3600, 'request exceeds VUh quota'\nEOF","typeGuard":null,"tryCatchPattern":"if err := client.WaitForTestRunReady(ctx, id, 0); err != nil {\n    if strings.Contains(err.Error(), \"test run aborted before starting\") {\n        // the suffix is the backend's reason (quota/validation/user abort):\n        // fix that cause, then start a NEW run - the aborted one cannot be resumed\n    }\n}","preventionTips":["Keep MaxVUs and duration within the organization's plan before launching","Watch the run's page in Grafana Cloud k6 when aborts recur - status history gives the authoritative reason","Coordinate with anyone who can abort runs so queued tests are not cancelled as 'stuck'"],"tags":["cloud","provisioning","abort","quota","configuration"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}