grafana/k6 · error
wait for test run ready: %w
Error message
wait for test run ready: %w
What it means
Client.ProvisionLocalExecution (internal/cloudapi/provisioning/provision.go:102) wraps the failure of Client.WaitForTestRunReady — the run never reached 'initializing'. The wrapped error distinguishes the causes: 'test run aborted before starting: <msg>' (backend aborted it, message included), 'test run completed before k6 could start', 'fetching test status: ...' (poll API failing), or context.Canceled/DeadlineExceeded if the caller gave up.
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 93accf6570)
Solutions
- Read the wrapped message — abort messages from the backend state the exact limit/reason
- Address the limit/quota named in the abort message, then re-run
- If context.Canceled, widen the outer timeout or avoid cancelling during provisioning
- Give PollInterval room (default 2s) and rely on the context, not external kills, to bound the wait
Defensive patterns
Strategy: try-catch
Validate before calling
provCtx, cancel := context.WithTimeout(ctx, 10*time.Minute) defer cancel() res, err := client.ProvisionLocalExecution(ctx2, provCtxParams) // pass provCtx
Type guard
func abortReason(err error) string {
if m := regexp.MustCompile(`test run aborted before starting: (.+)`); m.MatchString(err.Error()) {
return m.FindStringSubmatch(err.Error())[1]
}
return ""
} Try / catch
res, err := client.ProvisionLocalExecution(ctx, params)
if err != nil {
if reason := abortReason(err); reason != "" {
// backend refused the run: fix the named limit/quota before re-running
}
if errors.Is(err, context.Canceled) {
// user or outer timeout cancelled during the ready-wait
}
return err
} Prevention
- Give provisioning a generous, explicit context timeout
- Watch org concurrency/quota limits before starting runs
- Surface backend abort messages verbatim — they name the actionable cause
- Avoid cancelling the run during the provisioning window
When it happens
Trigger: Backend aborts the run before start (org concurrency limit, quota, maintenance); the caller's context is cancelled (Ctrl+C during provisioning); the v6 test-runs polling endpoint repeatedly failing; run completing before this k6 attached.
Common situations: Org hit its concurrent cloud test limit; user interrupted the run during the provisioning wait; backend incidents making the poll endpoint error; overly tight outer timeouts around provisioning.
Related errors
- test run completed before k6 could start
- fetching test status: %w
- test run aborted before starting: %s
- test run aborted before starting
- create or find load test: %w
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/b5919b3ef512a4ac.
Report an issue: GitHub.