grafana/k6 · error
wait for test run ready
Error message
wait for test run ready: %w
What it means
The final provisioning step failed: WaitForTestRunReady did not observe the cloud test run reach a ready/running state. This polls the test-run status and fails when the run transitions to an errored/invalid terminal state, when polling exceeds its time budget, or when the context is canceled — so the cloud side rejected or stalled the run after it was created.
Solutions
- Open the test run details page (TestRunDetailsPageURL was not returned, so find the run by testRunID in the Grafana Cloud UI) and read the cloud-side error
- If the failure is a timeout with the run still transitional, increase the wait budget / PollInterval tolerance and retry provisioning
- Re-verify options locally: `k6 inspect script.js` and a dry `k6 run` catch most option-level rejections
- If ctx was canceled (Ctrl+C in CI), fix the outer timeout or remove the cancellation
Example fix
// before res, err := client.ProvisionLocalExecution(ctx, params) // default poll interval // after params.PollInterval = 2 * time.Second // give the backend steadier polling ctx, cancel := context.WithTimeout(ctx, 10*time.Minute) defer cancel() res, err := client.ProvisionLocalExecution(ctx, params)
Defensive patterns
Strategy: retry
Validate before calling
if params.PollInterval <= 0 {
params.PollInterval = 5 * time.Second // explicit, predictable polling
}
if _, ok := ctx.Deadline(); !ok {
ctx, cancel = context.WithTimeout(ctx, 15*time.Minute)
} Try / catch
if err := c.WaitForTestRunReady(ctx, sleResp.TestRunID, params.PollInterval); err != nil {
if errors.Is(err, context.DeadlineExceeded) {
// run may still be preparing; check state once more before failing
return nil, fmt.Errorf("wait for test run ready timed out; check run %d in the UI: %w", sleResp.TestRunID, err)
}
return nil, fmt.Errorf("wait for test run ready: %w", err)
} Prevention
- Set an explicit outer context deadline sized to worst-case cloud preparation time
- Catch option-level rejections early with `k6 inspect` and local dry runs
- Log testRunID in every failure path so operators can jump straight to the UI
When it happens
Trigger: Cloud-side validation rejects the uploaded options or archive and marks the run errored; the run stays in a transitional state past the polling deadline; ctx canceled by user signal; or repeated 5xx while polling.
Common situations: Script options the backend refuses (unsupported scenarios or thresholds combinations), an archive that failed server-side processing, a long queue on the cloud service during peak times, or CI environments with tight outer timeouts killing the wait.
Related errors
- fetching test status
- an error occurred communicating with k6 Cloud
- archive_size
- archive upload failed
- archive upload failed
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/b5919b3ef512a4ac.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cloudapi/provisioning/provision.go:102
sleResp, err := c.StartLocalExecution(ctx, loadTestID, sleReq)
if err != nil {
return nil, fmt.Errorf("start local execution: %w", err)
}
switch {
case params.Archive != nil && sleResp.ArchiveUploadURL != nil:
if err := c.UploadArchive(ctx, *sleResp.ArchiveUploadURL, archiveBytes); err != nil {
return nil, fmt.Errorf("upload archive: %w", err)
}
case params.Archive != nil && sleResp.ArchiveUploadURL == nil:
// We had an archive to upload but the API returned no upload URL;
// proceed without uploading rather than failing the run.
c.logger.Warn("archive present but provisioning API returned no upload URL; skipping archive upload")
}
if err := c.WaitForTestRunReady(ctx, sleResp.TestRunID, params.PollInterval); err != nil {
return nil, fmt.Errorf("wait for test run ready: %w", err)
}
return &ProvisionResult{
TestRunID: sleResp.TestRunID,
TestRunDetailsPageURL: sleResp.TestRunDetailsPageURL,
RuntimeConfig: sleResp.RuntimeConfig,
}, nil
}
View on GitHub (pinned to 01ffac6f24)