{"record":{"id":"bc73b2ec78ec85d1","repo":"apache/dolphinscheduler","slug":"workflow-definition-not-exist-bc73b2","errorCode":"WORKFLOW_DEFINITION_NOT_EXIST","errorMessage":"WORKFLOW_DEFINITION_NOT_EXIST: workflow definition not found","messagePattern":"WORKFLOW_DEFINITION_NOT_EXIST: workflow definition not found","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java","lineNumber":992,"sourceCode":"\n    /**\n     * get task node details based on workflow definition\n     *\n     * @param loginUser   loginUser\n     * @param projectCode project code\n     * @param code        workflow definition code\n     * @return task node list\n     */\n    @Override\n    public List<TaskDefinition> getTaskNodeListByDefinitionCode(User loginUser, long projectCode, long code) {\n        Project project = projectDao.queryByCode(projectCode);\n        // check user access for project\n        projectService.checkProjectAndAuthThrowException(loginUser, project, null);\n\n        WorkflowDefinition workflowDefinition = workflowDefinitionDao.queryByCode(code).orElse(null);\n        if (workflowDefinition == null || projectCode != workflowDefinition.getProjectCode()) {\n            log.error(\"workflow definition does not exist, workflowDefinitionCode:{}.\", code);\n            throw new ServiceException(Status.WORKFLOW_DEFINITION_NOT_EXIST, String.valueOf(code));\n        }\n        DagData dagData = processService.genDagData(workflowDefinition);\n        return dagData.getTaskDefinitionList();\n    }\n\n    /**\n     * get task node details map based on workflow definition\n     *\n     * @param loginUser   loginUser\n     * @param projectCode project code\n     * @param codes       define codes\n     * @return task node list\n     */\n    @Override\n    public Map<Long, List<TaskDefinition>> getNodeListMapByDefinitionCodes(User loginUser, long projectCode,\n                                                                           String codes) {\n        Project project = projectDao.queryByCode(projectCode);\n        // check user access for project","sourceCodeStart":974,"sourceCodeEnd":1010,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java#L974-L1010","documentation":"Thrown by queryTaskDefinitionList (and similar by-code lookups) when no workflow definition with the given code exists, or the one found belongs to a different project than the projectCode path parameter. The caller asked for task definitions of a workflow that is not visible in the given project.","triggerScenarios":"GET /projects/{projectCode}/workflow/definition/{code}/tasks where code is wrong/deleted, or code exists but workflowDefinition.getProjectCode() != projectCode in the URL.","commonSituations":"Stale client caches after workflow deletion; using a workflow code copied from another project; typos in code/projectCode path segments; environments synced partially between instances.","solutions":["Verify the workflow code exists via the workflow definition list API for that project and use the correct code.","Ensure the projectCode in the URL matches the project that actually owns the workflow.","Re-create the workflow if it was deleted, or point the request at an existing one.","Confirm the logged-in user targets the right project (codes are unique across projects, but the URL binds them)."],"exampleFix":"// before\ncurl .../projects/123/workflow/definition/9999/tasks   // 9999 not in project 123\n// after\ncurl .../projects/123/workflow/definition/4860899582432/tasks  // code verified via list API","handlingStrategy":"validation","validationCode":"Optional<WorkflowDefinition> wf = workflowDefinitionDao.queryByCode(code);\nif (wf.isEmpty() || wf.get().getProjectCode() != projectCode) {\n    throw new IllegalArgumentException(\"workflow \" + code + \" not in project \" + projectCode);\n}","typeGuard":null,"tryCatchPattern":"try {\n    taskDefs = client.queryTaskDefinitionList(projectCode, code);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.WORKFLOW_DEFINITION_NOT_EXIST.getCode()) {\n        // refresh workflow list and correct the code\n    } else throw e;\n}","preventionTips":["Fetch codes dynamically from the project's workflow list API instead of hardcoding","Keep projectCode and workflow code paired together in client state","Handle workflow deletion events by invalidating cached codes"],"tags":["workflow-definition","not-found","rest-api"],"backgroundTag":"resource-not-found","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"}