{"record":{"id":"aad13ffe02912afc","repo":"apache/dolphinscheduler","slug":"10107","errorCode":"10107","errorMessage":"update workflow definition error","messagePattern":"update workflow definition error","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java","lineNumber":146,"sourceCode":"            throw new ServiceException(Status.TASK_DEFINE_NOT_EXIST, taskName);\n        }\n        return taskDefinition;\n    }\n\n    public void updateDag(User loginUser, long workflowDefinitionCode,\n                          List<WorkflowTaskRelation> workflowTaskRelationList,\n                          List<TaskDefinitionLog> taskDefinitionLogs) {\n        WorkflowDefinition workflowDefinition = workflowDefinitionDao.queryByCode(workflowDefinitionCode).orElse(null);\n        if (workflowDefinition == null) {\n            log.error(\"workflow definition does not exist, workflowDefinitionCode:{}.\", workflowDefinitionCode);\n            throw new ServiceException(Status.WORKFLOW_DEFINITION_NOT_EXIST);\n        }\n        int insertVersion =\n                processService.saveWorkflowDefine(loginUser, workflowDefinition, Boolean.TRUE, Boolean.TRUE);\n        if (insertVersion <= 0) {\n            log.error(\"Update workflow definition error, projectCode:{}, workflowDefinitionCode:{}.\",\n                    workflowDefinition.getProjectCode(), workflowDefinitionCode);\n            throw new ServiceException(Status.UPDATE_WORKFLOW_DEFINITION_ERROR);\n        } else\n            log.info(\n                    \"Save new version workflow definition complete, projectCode:{}, workflowDefinitionCode:{}, newVersion:{}.\",\n                    workflowDefinition.getProjectCode(), workflowDefinitionCode, insertVersion);\n        List<WorkflowTaskRelationLog> relationLogs =\n                workflowTaskRelationList.stream().map(WorkflowTaskRelationLog::new).collect(Collectors.toList());\n        int insertResult = processService.saveTaskRelation(loginUser, workflowDefinition.getProjectCode(),\n                workflowDefinition.getCode(),\n                insertVersion, relationLogs, taskDefinitionLogs, Boolean.TRUE);\n        if (insertResult == Constants.EXIT_CODE_SUCCESS) {\n            log.info(\n                    \"Save new version task relations complete, projectCode:{}, workflowDefinitionCode:{}, newVersion:{}.\",\n                    workflowDefinition.getProjectCode(), workflowDefinitionCode, insertVersion);\n        } else {\n            log.error(\"Update task relations error, projectCode:{}, workflowDefinitionCode:{}.\",\n                    workflowDefinition.getProjectCode(), workflowDefinitionCode);\n            throw new ServiceException(Status.UPDATE_WORKFLOW_DEFINITION_ERROR);\n        }","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java#L128-L164","documentation":"Thrown in updateDag when persisting the updated workflow/task relations fails (a DAO update returns failure or throws), meaning the new task-relation DAG could not be saved. It indicates a persistence-layer error rather than invalid input.","triggerScenarios":"Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java:146 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check server logs and database health for the underlying update failure.","Retry the DAG update after resolving database issues.","Verify the task relation list is internally consistent before retrying."],"exampleFix":null,"handlingStrategy":"try-catch","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-14T05:17:10.506Z"}