{"record":{"id":"2921b5ff1abd3481","repo":"kestra-io/kestra","slug":"execution-executionid-is-not-paused-can-t-res","errorCode":null,"errorMessage":"Execution '{executionId}' is not paused, can't resume it","messagePattern":"Execution '(.+?)' is not paused, can't resume it","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/services/ExecutionService.java","lineNumber":118,"sourceCode":"    private DispatchQueueInterface<ExecutionCommand> executionCommandQueue;\n\n    @Inject\n    private BroadcastQueueInterface<ExecutionKilled> killQueue;\n\n    @Inject\n    private AsyncOperationWaiter asyncOperationWaiter;\n\n    @Inject\n    private AsyncOperationsConfiguration asyncOperationsConfiguration;\n\n    @Inject\n    private Optional<OpenTelemetry> openTelemetry;\n\n    public Execution getExecutionIfPause(final String tenant, final @NotNull String executionId, boolean withACL) {\n        Execution execution = getExecution(tenant, executionId, withACL);\n\n        if (!execution.getState().isPaused()) {\n            throw new IllegalStateException(\"Execution '\" + executionId + \"' is not paused, can't resume it\");\n        }\n\n        return execution;\n    }\n\n    public Execution getExecution(final String tenant, final @NotNull String executionId, boolean withACL) {\n        Optional<Execution> maybeExecution = withACL ? executionRepository.findById(tenant, executionId) : executionRepository.findByIdWithoutAcl(tenant, executionId);\n\n        return maybeExecution\n            .orElseThrow(() -> new NoSuchElementException(\"Execution '\" + executionId + \"' not found.\"));\n    }\n\n    /**\n     * Retry set the given taskRun in the created state\n     * and return the execution in the running state\n     **/\n    public Execution retryTask(Execution execution, Flow flow, String taskRunId) throws InternalException {\n        TaskRun taskRun = execution.findTaskRunByTaskRunId(taskRunId).withState(State.Type.CREATED);","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/services/ExecutionService.java#L100-L136","documentation":"The `ExecutionService.getExecutionIfPause()` method retrieves an execution and checks whether it is in a paused state (`isPaused()` returns true for PAUSED and some PAUSED-on-breakpoint states). If the execution is not paused, an `IllegalStateException` is thrown. This guard prevents resume operations on executions that are actively running or already terminated.","triggerScenarios":"Calling the resume API (`POST /executions/{id}/resume`) on an execution that is RUNNING, SUCCESS, FAILED, etc. Calling resume on an execution that was already resumed by another user/request. Attempting to resume an execution that was never paused.","commonSituations":"A user clicks 'Resume' in the UI on an execution that has already been resumed. A race condition: two concurrent resume requests, the second one fails. The execution transitioned past PAUSED between the UI status check and the API call.","solutions":["Check the execution's current state before attempting to resume — only PAUSED executions can be resumed.","Refresh the execution status in the UI before clicking Resume.","Handle the `IllegalStateException` gracefully in automated resume scripts (the execution may have been resumed already).","If the execution should be paused but isn't, verify the Pause task or breakpoint configuration."],"exampleFix":"// before\nExecution exec = executionService.getExecutionIfPause(tenantId, executionId, true);\n// after\nExecution exec = executionRepository.findById(tenantId, executionId)\n    .orElseThrow(() -> new NoSuchElementException(\"Execution not found\"));\nif (!exec.getState().isPaused()) {\n    log.info(\"Execution {} is not paused (state: {}), skipping resume\", executionId, exec.getState().getCurrent());\n    return;\n}\nexec = executionService.getExecutionIfPause(tenantId, executionId, true);","handlingStrategy":"validation","validationCode":"// Check pause state before calling getExecutionIfPause\nExecution execution = executionRepository.findById(tenantId, executionId)\n    .orElseThrow(() -> new NoSuchElementException(\"Execution not found\"));\nif (!execution.getState().isPaused()) {\n    throw new IllegalStateException(\n        \"Cannot resume execution \" + executionId + \" in state \" + execution.getState().getCurrent());\n}\nExecution paused = executionService.getExecutionIfPause(tenantId, executionId, withACL);","typeGuard":"import { State } from './types';\n\nconst PAUSED_STATES: Set<State.Type> = new Set(['PAUSED']);\n\nfunction isResumable(state: State.Type): boolean {\n    return PAUSED_STATES.has(state);\n}","tryCatchPattern":"try {\n    Execution exec = executionService.getExecutionIfPause(tenantId, executionId, true);\n    // resume logic\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"is not paused\")) {\n        log.info(\"Execution {} is not paused, no resume needed\", executionId);\n        return; // idempotent: already resumed or was never paused\n    }\n    throw e;\n}","preventionTips":["Check `execution.getState().isPaused()` before calling resume.","Handle the 'not paused' exception gracefully in automated scripts (idempotent resume).","Refresh execution status in the UI before clicking Resume.","Be aware of race conditions with concurrent resume requests."],"tags":["execution","resume","state-machine","validation"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}