grafana/k6 · error

98

98

Error message

Test progress error

What it means

During `k6 cloud run`, k6 polls the cloud API for test progress every 2 seconds and logs per-poll failures as 'Test progress error' while continuing. If the wait loop ends with testProgress still nil — i.e. not a single poll ever succeeded — this error is returned with exit code 98 (CloudFailedToGetProgress), telling you k6 never learned the test's state.

Source

Thrown at internal/cmd/cloud.go:382

		testProgressLock.Lock()
		testProgress = newTestProgress
		testProgressLock.Unlock()

		if newTestProgress.IsFinished() ||
			(c.exitOnRunning && newTestProgress.IsRunning()) {
			globalCancel()
			break
		}
	}

	// Stop progress rendering before printing final status to avoid ghost bars.
	progressCancel()
	progressBarWG.Wait()

	if testProgress == nil {
		//nolint:staticcheck
		return errext.WithExitCodeIfNone(errors.New("Test progress error"), exitcodes.CloudFailedToGetProgress)
	}

	c.printTestStatus(testProgress.FormatStatus())

	if testProgress.ThresholdsFailed() {
		//nolint:staticcheck
		return errext.WithExitCodeIfNone(errors.New("Thresholds have been crossed"), exitcodes.ThresholdsHaveFailed)
	}
	if testProgress.TestFailed() {
		//nolint:staticcheck
		return errext.WithExitCodeIfNone(errors.New("The test has failed"), exitcodes.CloudTestRunFailed)
	}

	return nil
}

func (c *cmdCloud) printTestStatus(status string) {
	if !c.gs.Flags.Quiet {

View on GitHub (pinned to 93accf6570)

Solutions

  1. Read the 'Test progress error' log lines just above the final message — they contain the actual per-poll cause
  2. Re-authenticate with `k6 cloud login` if the logged cause is 401/403
  3. Check network/proxy stability for long-running requests if the cause is a transport error
  4. Open the test run in the Grafana Cloud UI to confirm it still exists and inspect its outcome

Example fix

# before
k6 cloud run script.js   # ends with: Test progress error (exit code 98)

# after: capture per-poll causes and verify auth/network first
K6_LOG_LEVEL=debug k6 cloud run script.js 2>&1 | tee cloud-run.log
# then fix whatever the repeated "Test progress error" lines report (401 -> re-login; timeout -> proxy/network)
Defensive patterns

Strategy: validation

Validate before calling

# preflight before a cloud run: auth valid and API reachable
k6 cloud login --show || exit 1
curl -fsS -o /dev/null "https://$K6_CLOUD_STACK.grafana.net" || { echo "stack unreachable"; exit 1; }

Try / catch

err := cmd.Execute() // k6 cloud run
if ee, ok := err.(*exec.ExitError); ok && ee.ExitCode() == exitcodes.CloudFailedToGetProgress {
    // every progress poll failed: inspect the 'Test progress error' log lines,
    // re-authenticate or fix networking, then re-run the test
}

Prevention

When it happens

Trigger: Every FetchTest(testRunID) poll fails for the entire watch window: invalid/expired token mid-run, network or proxy outage between you and the cloud API, the test run ID being aborted or removed server-side, or the run being interrupted before the first successful poll at t=2s.

Common situations: VPN/proxy dropping long-lived connections; token revoked while the test ran; test aborted from the Grafana Cloud UI immediately after start; flaky networking in CI containers. The per-poll cause is visible in the 'Test progress error' log lines printed above the final error.

Related errors


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/da0ceacee85e704b. Report an issue: GitHub.