{"record":{"id":"8f9c7a5fe17a9ed8","repo":"apache/dolphinscheduler","slug":"the-task-taskexecution-getname-state","errorCode":null,"errorMessage":"\"The task: \" + taskExecution.getName() + \" state: \" + taskInstance.getState() + \" is not \" + taskExecutionStatus","messagePattern":"\"The task: \" \\+ taskExecution\\.getName\\(\\) \\+ \" state: \" \\+ taskInstance\\.getState\\(\\) \\+ \" is not \" \\+ taskExecutionStatus","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/graph/WorkflowExecutionGraph.java","lineNumber":349,"sourceCode":"    @Override\n    public boolean isAllSuccessorsAreConditionTask(final ITaskExecution taskExecution) {\n        final List<ITaskExecution> successors = getSuccessors(taskExecution.getName());\n        if (CollectionUtils.isEmpty(successors)) {\n            return false;\n        }\n        return successors.stream().allMatch(\n                successor -> isTaskExecutionSkipped(successor)\n                        || (TaskTypeUtils.isConditionTask(successor.getTaskDefinition().getTaskType())\n                                && !isTaskExecutionForbidden(successor)));\n    }\n\n    private void assertTaskExecutionState(final ITaskExecution taskExecution,\n                                          final TaskExecutionStatus taskExecutionStatus) {\n        final TaskInstance taskInstance = taskExecution.getTaskInstance();\n        if (taskInstance.getState() == taskExecutionStatus) {\n            return;\n        }\n        throw new IllegalStateException(\n                \"The task: \" + taskExecution.getName() + \" state: \" + taskInstance.getState() + \" is not \"\n                        + taskExecutionStatus);\n    }\n\n}\n","sourceCodeStart":331,"sourceCodeEnd":355,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/graph/WorkflowExecutionGraph.java#L331-L355","documentation":"Thrown by WorkflowExecutionGraph.assertTaskExecutionState when a task instance's state does not match the expected TaskExecutionStatus during chain failure/pause/kill marking. The graph enforces that these state transitions only apply to tasks already in the expected state; a mismatch means concurrent state change or an out-of-order event. It surfaces as IllegalStateException.","triggerScenarios":"markTaskExecutionChainFailure/Pause/Kill invoked for a task whose TaskInstance.getState() differs from the expected status — e.g. the task already moved to KILL by another path, or a pause arrives after the task finished.","commonSituations":"Race between user pause/kill actions and task completion; duplicate master events processed twice; failover scenarios where the new master sees states the old one already advanced.","solutions":["Check the task instance's current state before issuing pause/kill/failure chain operations and skip if it already advanced.","Serialize pause/kill requests through the master to avoid racing with task completion events.","If seen during failover, resync task states from the DB before replaying chain operations."],"exampleFix":"// before: blind chain kill\ngraph.markTaskExecutionChainKill(taskExecution);\n// after: check state first\nif (taskExecution.getTaskInstance().getState() == TaskExecutionStatus.KILL) {\n    return;\n}\ngraph.markTaskExecutionChainKill(taskExecution);","handlingStrategy":"validation","validationCode":"// verify state before chain operations\nif (taskExecution.getTaskInstance().getState() != expectedStatus) {\n    return; // already advanced; skip chain failure/pause/kill\n}\ngraph.markTaskExecutionChainKill(taskExecution);","typeGuard":"boolean inExpectedState(ITaskExecution t, TaskExecutionStatus expected) {\n    return t.getTaskInstance().getState() == expected;\n}","tryCatchPattern":"try {\n    graph.markTaskExecutionChainKill(taskExecution);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"The task:\") && e.getMessage().contains(\"is not\")) {\n        // state advanced concurrently; log and continue\n    } else throw e;\n}","preventionTips":["Read the task's live state immediately before pause/kill/failure chain calls.","Treat these operations as idempotent-safe: skip when state already matches the target.","Investigate repeated occurrences for event duplication or failover races."],"tags":["workflow","state-machine","concurrency"],"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"}