{"record":{"id":"930ef15e712f00e0","repo":"grafana/k6","slug":"execution-is-already-paused","errorCode":null,"errorMessage":"execution is already paused","messagePattern":"execution is already paused","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/execution/scheduler.go","lineNumber":579,"sourceCode":"// will cause k6 to initialize all needed VUs, but it won't actually start the\n// test. Later, the test can be started for real by resuming/unpausing it from\n// the REST API.\n//\n// After a test is actually started, it may become impossible to pause it again.\n// That is signaled by having SetPaused(true) return an error. The likely cause\n// is that some of the executors for the test don't support pausing after the\n// test has been started.\n//\n// IMPORTANT: Currently only the externally controlled executor can be paused\n// and resumed multiple times in the middle of the test execution! Even then,\n// \"pausing\" is a bit misleading, since k6 won't pause in the middle of the\n// currently executing iterations. It will allow the currently in-progress\n// iterations to finish, and it just won't start any new ones nor will it\n// increment the value returned by GetCurrentTestRunDuration().\nfunc (e *Scheduler) SetPaused(pause bool) error {\n\tif !e.state.HasStarted() && e.state.IsPaused() {\n\t\tif pause {\n\t\t\treturn fmt.Errorf(\"execution is already paused\")\n\t\t}\n\t\te.state.Test.Logger.Debug(\"Starting execution\")\n\t\treturn e.state.Resume()\n\t}\n\n\tfor _, exec := range e.executors {\n\t\tpausableExecutor, ok := exec.(lib.PausableExecutor)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"%s executor '%s' doesn't support pause and resume operations after its start\",\n\t\t\t\texec.GetConfig().GetType(), exec.GetConfig().GetName(),\n\t\t\t)\n\t\t}\n\t\tif err := pausableExecutor.SetPaused(pause); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif pause {","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/execution/scheduler.go#L561-L597","documentation":"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.","triggerScenarios":"Thrown at internal/execution/scheduler.go:579 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The execution is already paused — just start/resume it (k6 resume or REST API PATCH status with 'resumed')","Only call pause again after the test has actually started"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}