{"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":"validation","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/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/execution/scheduler.go#L570-L602","documentation":"Once a test has started, Scheduler.SetPaused asks each executor to pause via the lib.PausableExecutor interface - and only the externally-controlled executor implements it. If any scenario uses another executor type (constant-vus, ramping-vus, per-vu-iterations, shared-iterations, constant-arrival-rate, ramping-arrival-rate), the loop returns this error naming the executor type and scenario that cannot be paused. Pause/resume after start is an externally-controlled-only feature (used by the cloud/distributed control plane).","triggerScenarios":"`k6 pause` / `k6 resume` or PUT /v1/status {\"data\":{\"attributes\":{\"paused\":true}}} on a running test whose options.scenarios contain any executor other than 'externally-controlled'.","commonSituations":"Teams wiring generic pause/resume buttons into locally-run or self-hosted k6 via the REST API; porting cloud-driven test control flows to plain local scenarios.","solutions":["If mid-test pause/resume is a hard requirement, drive the run with an externally-controlled executor scenario","Otherwise remove pause/resume from your tooling - plan the whole load shape declaratively via scenarios (stages, startTime) instead","Note the error names the first non-pausable executor; fixing that scenario alone is not enough, every scenario must be externally-controlled"],"exampleFix":"// before: normal scenario + external pause attempt -> error\nexport const options = { vus: 5, duration: '10m' };\n// `k6 pause` fails: constant-vus executor 'default' doesn't support pause and resume\n\n// after: externally-controlled executor can be paused/resumed after start\nexport const options = {\n  scenarios: {\n    ext: { executor: 'externally-controlled', vus: 2, maxVUs: 10, duration: '10m' },\n  },\n};","handlingStrategy":"validation","validationCode":"// before wiring pause/resume buttons, verify every scenario is externally-controlled\nimport Options from './options.json';\nconst allPausable = Object.values(Options.scenarios ?? {}).every(\n  (s) => s.executor === 'externally-controlled'\n);\nif (!allPausable) {\n  throw new Error('pause/resume controls require externally-controlled scenarios only');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat pause/resume as a cloud/externally-controlled feature; do not assume it works for local scenario types","Document which test profiles may be paused so operators do not try it on plain scenarios","Prefer declarative load shaping (stages, startTime) over interactive control for local runs"],"tags":["pause-resume","scenarios","externally-controlled","rest-api"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}