{"record":{"id":"2b1b91c02bd07273","repo":"apache/dolphinscheduler","slug":"50003","errorCode":"50003","errorMessage":"workflow definition {0} does not exist","messagePattern":"workflow definition (.+?) does not exist","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java","lineNumber":139,"sourceCode":"        // check user access for project\n        projectService.checkProjectAndAuthThrowException(loginUser, project, TASK_DEFINITION);\n\n        TaskDefinition taskDefinition =\n                taskDefinitionDao.queryByName(project.getCode(), workflowDefinitionCode, taskName);\n        if (taskDefinition == null) {\n            log.error(\"Task definition does not exist, taskName:{}.\", taskName);\n            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(","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java#L121-L157","documentation":"Raised in updateDag (also reachable via switchVersion) when the workflow definition for workflowDefinitionCode does not exist, so the DAG cannot be updated. It is an existence guard; the faulting input is the workflow definition code that has no matching record.","triggerScenarios":"Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java:139 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the workflow definition code is correct.","Ensure the workflow was not deleted before this call.","Refresh the workflow list to obtain valid codes."],"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-14T05:17:10.506Z"}