{"record":{"id":"44bcbf93f6ae3cac","repo":"grafana/k6","slug":"test-execution-wasn-t-paused","errorCode":null,"errorMessage":"test execution wasn't paused","messagePattern":"test execution wasn't paused","errorType":"http","errorClass":null,"httpStatus":500,"severity":"warning","filePath":"lib/execution.go","lineNumber":425,"sourceCode":"\n\tif !atomic.CompareAndSwapInt64(es.currentPauseTime, 0, time.Now().UnixNano()) {\n\t\treturn errors.New(\"test execution was already paused\")\n\t}\n\tes.resumeNotify = make(chan struct{})\n\treturn nil\n}\n\n// Resume unpauses the test execution. Unless the test wasn't\n// yet started, it calculates the duration between now and\n// the old currentPauseTime and adds it to\n// Resume will emit an error if the test wasn't paused.\nfunc (es *ExecutionState) Resume() error {\n\tes.pauseStateLock.Lock()\n\tdefer es.pauseStateLock.Unlock()\n\n\tcurrentPausedTime := atomic.SwapInt64(es.currentPauseTime, 0)\n\tif currentPausedTime == 0 {\n\t\treturn errors.New(\"test execution wasn't paused\")\n\t}\n\n\t// Check that it's not the pause before execution actually starts\n\tif atomic.LoadInt64(es.startTime) != 0 {\n\t\tes.totalPausedDuration += time.Duration(time.Now().UnixNano() - currentPausedTime)\n\t}\n\n\tclose(es.resumeNotify)\n\n\treturn nil\n}\n\n// ResumeNotify returns a channel which will be closed (i.e. could\n// be read from) as soon as the test execution is resumed.\n//\n// Since tests would likely be paused only rarely, unless you\n// directly need to be notified via a channel that the test\n// isn't paused or that it has resumed, it's probably a good","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/lib/execution.go#L407-L443","documentation":"ExecutionState.Resume() swaps currentPauseTime back to 0 to end a pause; if the swapped value was already 0 the test was not paused, so Resume() has nothing to resume and returns this error. It is the counterpart guard to Pause()'s 'already paused' error.","triggerScenarios":"Calling POST /v1/resume on a running (never paused) test, or resuming twice after a single pause.","commonSituations":"Startup scripts that unconditionally resume 'just in case'; resuming after the pause already ended (double resume); orchestrators that lost track of the pause state.","solutions":["Check GET /v1/status and only resume when paused:true","Ensure exactly one resume follows each pause in automation scripts","Treat 'wasn't paused' as benign in idempotent wrappers (ignore this specific error)"],"exampleFix":"# before\nk6 resume   # test was never paused -> error\n\n# after\nk6 status | grep -q '\"paused\": true' && k6 resume || echo 'not paused, skipping'","handlingStrategy":"validation","validationCode":"status=$(curl -s http://localhost:6565/v1/status)\necho \"$status\" | grep -q '\"paused\": *true' && curl -sX POST http://localhost:6565/v1/resume || echo 'not paused, skipping resume'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only resume when /v1/status reports paused:true","Treat 'wasn\\u2019t paused' as a benign no-op in wrappers","Track pause state in the orchestrator instead of guessing"],"tags":["execution","pause-resume","rest-api","state"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}