Grafana Cloud

Troubleshoot Grafana Cloud k6

This topic describes common issues and how to resolve them when running performance tests in Grafana Cloud k6.

setup() times out

If your test fails before virtual users (VUs) start and the run shows a timeout during the setup phase, the setup() function did not complete within the allowed time.

What you might see

The test fails before any VUs start, and the logs contain errors similar to:

level=error msg="Error during setup() execution/propagation" error="Error executing setup: setup() execution timed out after 60 seconds"
level=error msg="Failed to run setup()" error="Error executing setup: setup() execution timed out after 60 seconds"

The timeout duration in the message reflects the configured setupTimeout value (default 60s).

Common causes

  • setup() performs slow or blocking operations (for example, many sequential HTTP calls, large data processing, or external service waits).
  • sleep() or long delays are used in setup(), so it runs longer than the timeout.
  • The script sets a high setupTimeout in options, but in Grafana Cloud k6, the maximum supported value is 10 minutes; any higher value is limited to 10 minutes. This limit is enforced server-side, is independent of VU quotas or subscription limits, and applies to all Grafana Cloud k6 users. It can’t be changed per subscription or organization.

How to fix it

  1. Shorten setup work: Move non-essential work out of setup() (for example, do it in init or in the VU code if acceptable). Keep setup() limited to what must run once before the test, such as fetching shared test data or starting a test environment.
  2. Avoid or minimize sleep() in setup: Use sleep() only when necessary in setup(); long sleeps can cause setup to exceed the timeout. Refer to Test lifecycle and sleep().
  3. Restructure long-running setup logic: If setup() genuinely needs more than 10 minutes, move expensive work to an external process or a warm-up scenario. Pass the results to your test through a file or environment variable.
  4. Use a shorter timeout to fail fast: If setup should complete quickly, set a lower setupTimeout (for example, '30s') to surface problems sooner.
  5. Check project and platform limits: The setup timeout is independent of VU or duration quotas. For other limits, refer to Manage project limits and quotas.

For more information, refer to the setupTimeout option reference and the test lifecycle documentation.