grafana/k6 · warning
test execution was already paused
Error message
test execution was already paused
What it means
ExecutionState.Pause() pauses the whole test run by CAS-ing currentPauseTime from 0 to now under pauseStateLock; if the CAS fails the test was already paused and the duplicate Pause() returns this error. Pausing freezes iteration timing until Resume() is called.
Source
Thrown at lib/execution.go:409
} else {
// The test isn't paused or finished, use the current time instead
endTime = time.Now().UnixNano()
}
}
return time.Duration(endTime-startTime) - pausedDuration
}
// Pause pauses the current execution. It acquires the lock, writes
// the current timestamp in currentPauseTime, and makes a new
// channel for resumeNotify.
// Pause can return an error if the test was already paused.
func (es *ExecutionState) Pause() error {
es.pauseStateLock.Lock()
defer es.pauseStateLock.Unlock()
if !atomic.CompareAndSwapInt64(es.currentPauseTime, 0, time.Now().UnixNano()) {
return errors.New("test execution was already paused")
}
es.resumeNotify = make(chan struct{})
return nil
}
// Resume unpauses the test execution. Unless the test wasn't
// yet started, it calculates the duration between now and
// the old currentPauseTime and adds it to
// Resume will emit an error if the test wasn't paused.
func (es *ExecutionState) Resume() error {
es.pauseStateLock.Lock()
defer es.pauseStateLock.Unlock()
currentPausedTime := atomic.SwapInt64(es.currentPauseTime, 0)
if currentPausedTime == 0 {
return errors.New("test execution wasn't paused")
}
View on GitHub (pinned to 93accf6570)
Solutions
- Check status first: GET /v1/status shows paused:true — only pause when it is false
- After pausing, resume with POST /v1/resume before pausing again
- Make automation idempotent: treat 'already paused' as success instead of re-issuing
Example fix
# before k6 pause # ... later, without resume k6 pause # exits with error: test execution was already paused # after k6 status | grep -q '"paused": true' || k6 pause
Defensive patterns
Strategy: validation
Validate before calling
# check before pausing status=$(curl -s http://localhost:6565/v1/status) echo "$status" | grep -q '"paused": *false' && curl -sX POST http://localhost:6565/v1/pause || echo 'already paused'
Prevention
- Poll /v1/status before issuing pause/resume commands
- Make orchestration scripts idempotent around pause state
- Pair every pause with exactly one resume in automation
When it happens
Trigger: Calling the REST API 'POST /v1/pause' twice without an intervening /v1/resume, or programmatically calling Pause() twice on the ExecutionState shared by the run.
Common situations: Automation/CI scripts that fire pause on a timer without checking state; two operators (or a dashboard and a script) pausing concurrently; retry logic that re-issues pause because the first response was missed.
Related errors
- test execution wasn't paused
- execution is already paused
- %s executor '%s' doesn't support pause and resume operations
- The REST API server is disabled, but this command needs to r
- getting scenario information outside of the VU context is no
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/e22f3cefe3d9994d.
Report an issue: GitHub.