{"record":{"id":"add22d0cee2ee341","repo":"apache/dolphinscheduler","slug":"workflow-instance-executing-command","errorCode":"WORKFLOW_INSTANCE_EXECUTING_COMMAND","errorMessage":"workflow instance is executing the command, workflowDefinitionCode:{}, workflowDefinitionVersion:{}, workflowInstanceId:{}.","messagePattern":"workflow instance is executing the command, workflowDefinitionCode:(.+?), workflowDefinitionVersion:(.+?), workflowInstanceId:(.+?)\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java","lineNumber":340,"sourceCode":"        // To add startParams only when repeat running is needed\n        Map<String, Object> cmdParam = new HashMap<>();\n        cmdParam.put(CMD_PARAM_RECOVER_WORKFLOW_ID_STRING, workflowInstanceId);\n        // Add StartNodeList\n        cmdParam.put(CMD_PARAM_START_NODES, startNodeList);\n\n        Command command = new Command();\n        command.setCommandType(CommandType.EXECUTE_TASK);\n        command.setWorkflowDefinitionCode(workflowDefinition.getCode());\n        command.setCommandParam(JSONUtils.toJsonString(cmdParam));\n        command.setExecutorId(loginUser.getId());\n        command.setWorkflowDefinitionVersion(workflowDefinition.getVersion());\n        command.setWorkflowInstanceId(workflowInstanceId);\n\n        // Add taskDependType\n        command.setTaskDependType(taskDependType);\n\n        if (!commandService.verifyIsNeedCreateCommand(command)) {\n            log.warn(\n                    \"workflow instance is executing the command, workflowDefinitionCode:{}, workflowDefinitionVersion:{}, workflowInstanceId:{}.\",\n                    workflowDefinition.getCode(), workflowDefinition.getVersion(), workflowInstanceId);\n            putMsg(response, Status.WORKFLOW_INSTANCE_EXECUTING_COMMAND,\n                    String.valueOf(workflowDefinition.getCode()));\n            return response;\n        }\n\n        log.info(\"Creating command, commandInfo:{}.\", command);\n        int create = commandService.createCommand(command);\n\n        if (create > 0) {\n            log.info(\"Create {} command complete, workflowDefinitionCode:{}, workflowDefinitionVersion:{}.\",\n                    command.getCommandType().getDescp(), command.getWorkflowDefinitionCode(),\n                    workflowDefinition.getVersion());\n            putMsg(response, Status.SUCCESS);\n        } else {\n            log.error(\n                    \"Execute workflow instance failed because create {} command error, workflowDefinitionCode:{}, workflowDefinitionVersion:{}， workflowInstanceId:{}.\",","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java#L322-L358","documentation":"A concurrency guard in ExecutorServiceImpl.executeTask: the target workflow instance is currently executing a command (an active Command row references it), so a new EXECUTE_TASK command would race the running one and corrupt state — the request is rejected instead. The message names the workflow definition code/version and instance id; it is a transient state conflict, not a data corruption.","triggerScenarios":"Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java:340 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry after the in-flight command for the instance completes (poll instance state)","Stop or wait for the running execution before triggering task-level execution again","If no command is actually running, check for orphaned rows in t_ds_command referencing the instance and clean them"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}