{"record":{"id":"a811a2eca4e6033b","repo":"grafana/k6","slug":"s-executor-s-doesn-t-support-pause-and-resume","errorCode":null,"errorMessage":"%s executor '%s' doesn't support pause and resume operations after its start","messagePattern":"(.+?) executor '(.+?)' doesn't support pause and resume operations after its start","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/execution/scheduler.go","lineNumber":588,"sourceCode":"// 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 {\n\t\treturn e.state.Pause()\n\t}\n\treturn e.state.Resume()\n}\n","sourceCodeStart":570,"sourceCodeEnd":602,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/execution/scheduler.go#L570-L602","documentation":"SetPaused capability guard: after a test has started, only the externally-controlled executor supports pause/resume. Any other executor type in the scheduler causes SetPaused to reject the operation once execution is underway — it is not a bug, it's an unsupported-operation error.","triggerScenarios":"Thrown at internal/execution/scheduler.go:588 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the externally-controlled executor (execution: external via REST API) if mid-test pause/resume is required","Pause before test start instead (k6 run --paused)","Avoid pause/resume for other executor types after start"],"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"}