{"record":{"id":"ac6d799ac2197cc4","repo":"flowable/flowable-engine","slug":"getsuspendedexceptionmessageprefix-a-suspend","errorCode":null,"errorMessage":"getSuspendedExceptionMessagePrefix() + \" a suspended \" + execution","messagePattern":"getSuspendedExceptionMessagePrefix\\(\\) \\+ \" a suspended \" \\+ execution","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/NeedsActiveExecutionCmd.java","lineNumber":52,"sourceCode":"\n    public NeedsActiveExecutionCmd(String executionId) {\n        this.executionId = executionId;\n    }\n\n    @Override\n    public T execute(CommandContext commandContext) {\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"executionId is null\");\n        }\n\n        ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(executionId);\n\n        if (execution == null) {\n            throw new FlowableObjectNotFoundException(\"execution \" + executionId + \" doesn't exist\", Execution.class);\n        }\n\n        if (execution.isSuspended()) {\n            throw new FlowableException(getSuspendedExceptionMessagePrefix() + \" a suspended \" + execution);\n        }\n\n        return execute(commandContext, execution);\n    }\n\n    /**\n     * Subclasses should implement this method. The provided {@link ExecutionEntity} is guaranteed to be active (ie. not suspended).\n     */\n    protected abstract T execute(CommandContext commandContext, ExecutionEntity execution);\n\n    /**\n     * Subclasses can override this to provide a more detailed exception message that will be thrown when the execution is suspended.\n     */\n    protected String getSuspendedExceptionMessagePrefix() {\n        return \"Cannot execute operation for\";\n    }\n\n}","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/NeedsActiveExecutionCmd.java#L34-L70","documentation":"Flowable refuses to run commands extending NeedsActiveExecutionCmd against a suspended execution. The command first looks up the execution, then checks isSuspended(); if the execution (or its process instance) was suspended via RuntimeService.suspendProcessInstanceById or suspendExecution, the operation is aborted with a FlowableException.","triggerScenarios":"Calling trigger/signal/message commands on an execution whose process instance was put in SUSPENDED state (e.g. via RuntimeService.suspendProcessInstanceById or suspendProcessInstanceByKey).","commonSituations":"Admin suspended a process definition or instance for maintenance while in-flight messages/signals still arrive; job triggers firing against suspended instances; tests reusing suspended fixtures.","solutions":["Resume the instance first with runtimeService.activateProcessInstanceById(processInstanceId), then retry the command.","Check suspension state before calling: inspect ExecutionEntity.isSuspended() via RuntimeService.createExecutionQuery().executionId(id).singleResult().isSuspended().","If suspension is intentional, stop delivering signals/triggers to that instance and route them to a queue until reactivation.","Catch FlowableException and handle the suspended-business-flow case explicitly in the caller."],"exampleFix":"// before\nruntimeService.trigger(executionId);\n// after\nExecution execution = runtimeService.createExecutionQuery().executionId(executionId).singleResult();\nif (execution != null && !execution.isSuspended()) {\n    runtimeService.trigger(executionId);\n}","handlingStrategy":"validation","validationCode":"Execution exec = runtimeService.createExecutionQuery().executionId(executionId).singleResult();\nif (exec != null && exec.isSuspended()) { throw new IllegalStateException(\"Execution is suspended\"); }","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.trigger(executionId);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"suspended\")) {\n        runtimeService.activateProcessInstanceById(processInstanceId);\n        runtimeService.trigger(executionId); // retry once\n    } else { throw e; }\n}","preventionTips":["Check isSuspended() on executions/instances before sending signals.","Track suspension windows (maintenance) and pause signal producers during them.","Prefer activateProcessInstanceById before resuming business operations.","Surface suspension state in monitoring dashboards."],"tags":["flowable","suspended-execution","invalid-state"],"backgroundTag":"invalid-state-transition","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}