{"record":{"id":"11b0bc6d752617a6","repo":"apache/dolphinscheduler","slug":"the-workflow-workflowexecution-getname","errorCode":null,"errorMessage":"\"The workflow: \" + workflowExecution.getName() + \" state is \" + workflowExecution.getState() + \" can only finish with success/failed/paused but exist task chain which state is not success/failure/pause\"","messagePattern":"\"The workflow: \" \\+ workflowExecution\\.getName\\(\\) \\+ \" state is \" \\+ workflowExecution\\.getState\\(\\) \\+ \" can only finish with success/failed/paused but exist task chain which state is not success/failure/pause\"","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/statemachine/WorkflowReadyPauseStateAction.java","lineNumber":148,"sourceCode":"        }\n        final IWorkflowExecutionGraph workflowExecutionGraph = workflowExecution.getWorkflowExecutionGraph();\n        final WorkflowEventBus workflowEventBus = workflowExecution.getWorkflowEventBus();\n        if (workflowExecutionGraph.isExistPausedTaskExecutionChain()) {\n            workflowEventBus.publish(WorkflowPausedLifecycleEvent.of(workflowExecution));\n            return;\n        }\n\n        if (workflowExecutionGraph.isExistFailureTaskExecutionChain()) {\n            workflowEventBus.publish(WorkflowFailedLifecycleEvent.of(workflowExecution));\n            return;\n        }\n\n        if (workflowExecutionGraph.isAllTaskExecutionChainSuccess()) {\n            workflowEventBus.publish(WorkflowSucceedLifecycleEvent.of(workflowExecution));\n            return;\n        }\n\n        throw new IllegalStateException(\n                \"The workflow: \" + workflowExecution.getName() + \" state is \"\n                        + workflowExecution.getState()\n                        + \" can only finish with success/failed/paused but exist task chain which state is not success/failure/pause\");\n    }\n}\n","sourceCodeStart":130,"sourceCodeEnd":154,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/statemachine/WorkflowReadyPauseStateAction.java#L130-L154","documentation":"Thrown by the READY_PAUSE state action when the workflow is finishing from a ready-to-pause state but the task execution graph does not support any legal terminal outcome. The engine only allows a ready-paused workflow to end as success, failed, or paused; if some task chain is still in a state outside success/failure/pause, no finished event can be validly published, so the invariant is enforced by throwing.","triggerScenarios":"onStartEvent -> emitWorkflowFinishedEventIfApplicable while workflow state is READY_PAUSE and workflowExecutionGraph.isAllTaskExecutionChainSuccess() is false, yet no task chain reached failed/pause either (e.g. a chain stuck in a non-terminal or unexpected state such as DISPATCH or a killed task when pause semantics expect pause/failed).","commonSituations":"Worker failures or task-kill timeouts leaving task chains in states the pause path does not expect; engine bugs in failover; running a modified/older master where pause handling of killed tasks differs; concurrent stop+pause commands.","solutions":["Check the task instance states in the UI/DB to find which chain is in an unexpected state and resolve it (retry, kill, or force-success the task).","Restart/resume the workflow so remaining chains reach a terminal state before finishing.","Check master logs for failover or worker-disconnect events that left chains non-terminal; upgrade the master if this recurs.","If reproducible with stock code, file a bug with the workflow execution graph dump — this branch indicates a state-machine invariant bug."],"exampleFix":"// before\nthrow new IllegalStateException(\"... exist task chain which state is not success/failure/pause\");\n// after\nif (workflowExecutionGraph.isAllTaskExecutionChainFinished()) {\n    workflowEventBus.publish(WorkflowPauseLifecycleEvent.of(workflowExecution));\n    return;\n}\nthrow new IllegalStateException(\"... exist task chain which state is not success/failure/pause\");","handlingStrategy":"try-catch","validationCode":"if (workflowExecutionGraph.isAllTaskExecutionChainSuccess()\n        || workflowExecutionGraph.isAllTaskExecutionChainFailed()\n        || workflowExecutionGraph.isAllTaskExecutionChainPause()) {\n    emitWorkflowFinishedEventIfApplicable(workflowExecution);\n}","typeGuard":null,"tryCatchPattern":"try {\n    emitWorkflowFinishedEventIfApplicable(workflowExecution);\n} catch (IllegalStateException e) {\n    log.error(\"Workflow {} cannot finish from pause: {}\", workflowExecution.getName(), e.getMessage());\n    // inspect remaining task chains and resolve stuck task\n}","preventionTips":["Ensure kill/pause commands propagate to all workers so chains reach terminal states","Monitor for task chains stuck in DISPATCH or non-terminal states","Avoid issuing pause and stop concurrently on the same workflow","Dump the execution graph state before reporting the bug"],"tags":["state-machine","workflow-engine","illegal-state","pause","task-chain"],"backgroundTag":"invalid-state-transition","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}