{"record":{"id":"709cd9e27c92df97","repo":"grafana/k6","slug":"starting-test-w","errorCode":null,"errorMessage":"starting test: %w","messagePattern":"starting test: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/cloud.go","lineNumber":277,"sourceCode":"\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\texecutionPlan := test.derivedConfig.Scenarios.GetFullExecutionRequirements(et)\n\t\ttestURL, err := resolveCloudTestURL(cloudConfig.StackURL.String, loadTest.GetId())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tprintExecutionDescription(\n\t\t\tc.gs, \"cloud\", test.sourceRootPath, testURL, test.derivedConfig, et, executionPlan, nil,\n\t\t)\n\t\tmodifyAndPrintBar(c.gs, progressBar, pb.WithConstLeft(\"Run \"), pb.WithConstProgress(1.0, \"Archived\"))\n\t\tc.printTestStatus(\"Archived\")\n\t\treturn nil\n\t}\n\n\trun, err := client.StartTest(globalCtx, loadTest.GetId())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"starting test: %w\", err)\n\t}\n\ttestRunID := run.GetId()\n\n\t// Trap Interrupts, SIGINTs and SIGTERMs.\n\tgracefulStop := func(sig os.Signal) {\n\t\tlogger.WithField(\"sig\", sig).Print(\"Stopping cloud test run in response to signal...\")\n\t\t// Do this in a separate goroutine so that if it blocks, the\n\t\t// second signal can still abort the process execution.\n\t\tgo func() {\n\t\t\tstopErr := client.StopTest(context.WithoutCancel(globalCtx), testRunID)\n\t\t\tif stopErr != nil {\n\t\t\t\tlogger.WithError(stopErr).Error(\"Stop cloud test error\")\n\t\t\t} else {\n\t\t\t\tlogger.Info(\"Successfully sent signal to stop the cloud test, now waiting for it to actually stop...\")\n\t\t\t}\n\t\t\tglobalCancel()\n\t\t}()\n\t}","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cmd/cloud.go#L259-L295","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the wrapped error text: the server's ResponseError details the refusal reason","Check the project/org quota and plan limits in Grafana Cloud","Simplify script options (scenarios, thresholds) to isolate a rejected setting","Re-authenticate with `k6 cloud login` if permissions changed, then retry"],"exampleFix":"# before\nk6 cloud script.js  # start rejected: quota exceeded\n# after\nk6 cloud run --local-execution script.js  # or raise quota / reduce runs","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, err := client.StartTest(ctx, loadTest.GetId()); err != nil {\n    var re cloudapiv6.ResponseError\n    if errors.As(err, &re) && re.Response.StatusCode >= 500 {\n        // transient: retry starting after backoff; the uploaded test is reusable\n    }\n    // permanent (quota/permissions): surface the server message and stop\n}","preventionTips":["Monitor project quota/plan limits before scheduling heavy test runs","Dry-run locally with `k6 cloud run --local-execution` to catch rejected options cheaply","Automate token/permission refresh so start calls never fail on stale auth"],"tags":["cloud-api","test-lifecycle","quota","network"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}