{"record":{"id":"c49f192691d2a3e1","repo":"apache/dolphinscheduler","slug":"the-workflow-workflowexecution-getname-c49f19","errorCode":null,"errorMessage":"\"The workflow: \" + workflowExecution.getName() + \" state is \" + workflowExecution.getState() + \" can only finish with success/failed/stop but exist task chain which state is not success/failure/kill\"","messagePattern":"\"The workflow: \" \\+ workflowExecution\\.getName\\(\\) \\+ \" state is \" \\+ workflowExecution\\.getState\\(\\) \\+ \" can only finish with success/failed/stop but exist task chain which state is not success/failure/kill\"","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/statemachine/WorkflowReadyStopStateAction.java","lineNumber":149,"sourceCode":"        final IWorkflowExecutionGraph workflowExecutionGraph =\n                workflowExecution.getWorkflowExecuteContext().getWorkflowExecutionGraph();\n        final WorkflowEventBus workflowEventBus = workflowExecution.getWorkflowEventBus();\n        if (workflowExecutionGraph.isExistKilledTaskExecutionChain()) {\n            workflowEventBus.publish(WorkflowStoppedLifecycleEvent.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/stop but exist task chain which state is not success/failure/kill\");\n    }\n}\n","sourceCodeStart":131,"sourceCodeEnd":155,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/statemachine/WorkflowReadyStopStateAction.java#L131-L155","documentation":"Thrown by the READY_STOP state action when a workflow in READY_STOP state is asked to emit a finished event but the task execution graph has chains whose state is not success/failure/kill. Stop semantics permit finishing only via success, failed, or kill; any other chain state makes a finished event invalid, so the engine throws this IllegalStateException.","triggerScenarios":"onStartEvent -> emitWorkflowFinishedEventIfApplicable while workflow state is READY_STOP and not all task chains are success, with at least one chain in a state other than failed or kill (e.g. still running after the stop request, in dispatch, or paused).","commonSituations":"A stop command raced with task completion or with a pause command; workers failed to ACK the kill so chains never reached KILL; failover left chains in DISPATCH; custom event handling bypassing normal stop flow.","solutions":["Find the offending task chain state in the workflow instance detail and manually kill or force-finish the stuck task.","Re-issue a stop (kill) command so remaining chains transition to KILL, then let the workflow finish.","Check master logs for kill-timeout or worker-unreachable errors; ensure workers are healthy and reachable.","Upgrade the master if stop/kill races repeatedly leave chains non-terminal; report as a bug if stock code hits this."],"exampleFix":"// before\nthrow new IllegalStateException(\"... exist task chain which state is not success/failure/kill\");\n// after\nif (workflowExecutionGraph.isAllTaskExecutionChainFinished()) {\n    workflowEventBus.publish(WorkflowStopLifecycleEvent.of(workflowExecution));\n    return;\n}\nthrow new IllegalStateException(\"... exist task chain which state is not success/failure/kill\");","handlingStrategy":"try-catch","validationCode":"if (workflowExecutionGraph.isAllTaskExecutionChainSuccess()\n        || workflowExecutionGraph.isAllTaskExecutionChainFailed()\n        || workflowExecutionGraph.isAllTaskExecutionChainKill()) {\n    emitWorkflowFinishedEventIfApplicable(workflowExecution);\n}","typeGuard":null,"tryCatchPattern":"try {\n    emitWorkflowFinishedEventIfApplicable(workflowExecution);\n} catch (IllegalStateException e) {\n    log.error(\"Workflow {} cannot finish from stop: {}\", workflowExecution.getName(), e.getMessage());\n    // re-issue kill for chains not in KILL state\n}","preventionTips":["Verify workers ACK kill requests so chains reach KILL state","Keep workers reachable; failover can leave chains in DISPATCH","Avoid racing stop with pause/complete on the same execution","Re-issue stop (kill) if the workflow stays in READY_STOP"],"tags":["state-machine","workflow-engine","illegal-state","stop","kill"],"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"}