grafana/k6 · error

execution is already paused

Error message

execution is already paused

What it means

SetPaused(true) no-op guard: the test hasn't started yet and the scheduler is already in a paused state (it was initialized with paused=true via --paused or the REST API), so pausing again is rejected as a state error rather than silently ignored.

Solutions

  1. The execution is already paused — just start/resume it (k6 resume or REST API PATCH status with 'resumed')
  2. Only call pause again after the test has actually started
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/execution/scheduler.go:579 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/930ef15e712f00e0. Report an issue: GitHub.

Appendix: source

Thrown at internal/execution/scheduler.go:579

// will cause k6 to initialize all needed VUs, but it won't actually start the
// test. Later, the test can be started for real by resuming/unpausing it from
// the REST API.
//
// After a test is actually started, it may become impossible to pause it again.
// That is signaled by having SetPaused(true) return an error. The likely cause
// is that some of the executors for the test don't support pausing after the
// test has been started.
//
// IMPORTANT: Currently only the externally controlled executor can be paused
// and resumed multiple times in the middle of the test execution! Even then,
// "pausing" is a bit misleading, since k6 won't pause in the middle of the
// currently executing iterations. It will allow the currently in-progress
// iterations to finish, and it just won't start any new ones nor will it
// increment the value returned by GetCurrentTestRunDuration().
func (e *Scheduler) SetPaused(pause bool) error {
	if !e.state.HasStarted() && e.state.IsPaused() {
		if pause {
			return fmt.Errorf("execution is already paused")
		}
		e.state.Test.Logger.Debug("Starting execution")
		return e.state.Resume()
	}

	for _, exec := range e.executors {
		pausableExecutor, ok := exec.(lib.PausableExecutor)
		if !ok {
			return fmt.Errorf(
				"%s executor '%s' doesn't support pause and resume operations after its start",
				exec.GetConfig().GetType(), exec.GetConfig().GetName(),
			)
		}
		if err := pausableExecutor.SetPaused(pause); err != nil {
			return err
		}
	}
	if pause {

View on GitHub (pinned to 01ffac6f24)