{"record":{"id":"ea571d689316e3d0","repo":"apache/dolphinscheduler","slug":"workflow-definition-not-exist","errorCode":"WORKFLOW_DEFINITION_NOT_EXIST","errorMessage":"WORKFLOW_DEFINITION_NOT_EXIST","messagePattern":"WORKFLOW_DEFINITION_NOT_EXIST","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java","lineNumber":133,"sourceCode":"    @Autowired\n    private BackfillWorkflowRequestTransformer backfillWorkflowRequestTransformer;\n\n    @Autowired\n    private BackfillWorkflowDTOValidator backfillWorkflowDTOValidator;\n\n    @Autowired\n    private ExecutorClient executorClient;\n\n    @Override\n    @Transactional\n    public Integer triggerWorkflowDefinition(final WorkflowTriggerRequest triggerRequest) {\n        projectService.checkHasProjectWritePermissionThrowException(\n                triggerRequest.getLoginUser(), triggerRequest.getProjectCode());\n        final TriggerWorkflowDTO triggerWorkflowDTO = triggerWorkflowRequestTransformer.transform(triggerRequest);\n        // verify the workflow definition belongs to the URL's project\n        if (triggerWorkflowDTO.getWorkflowDefinition() == null\n                || triggerWorkflowDTO.getWorkflowDefinition().getProjectCode() != triggerRequest.getProjectCode()) {\n            throw new ServiceException(Status.WORKFLOW_DEFINITION_NOT_EXIST,\n                    String.valueOf(triggerRequest.getWorkflowDefinitionCode()));\n        }\n        // todo: use validator chain\n        triggerWorkflowDTOValidator.validate(triggerWorkflowDTO);\n        return executorClient.triggerWorkflowDefinition().execute(triggerWorkflowDTO);\n    }\n\n    @Override\n    @Transactional\n    public List<Integer> backfillWorkflowDefinition(final WorkflowBackFillRequest workflowBackFillRequest) {\n        projectService.checkHasProjectWritePermissionThrowException(\n                workflowBackFillRequest.getLoginUser(), workflowBackFillRequest.getProjectCode());\n        final BackfillWorkflowDTO backfillWorkflowDTO =\n                backfillWorkflowRequestTransformer.transform(workflowBackFillRequest);\n        // verify the workflow definition belongs to the URL's project\n        if (backfillWorkflowDTO.getWorkflowDefinition() == null\n                || backfillWorkflowDTO.getWorkflowDefinition().getProjectCode() != workflowBackFillRequest\n                        .getProjectCode()) {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java#L115-L151","documentation":"Thrown by triggerWorkflowDefinition when the workflow definition cannot be loaded for the given code, or when it exists but belongs to a different project than the one in the request URL. The check after triggerWorkflowRequestTransformer.transform ensures the definition is both present and scoped to the URL's project.","triggerScenarios":"POST trigger with a workflowDefinitionCode that doesn't exist, or exists under another project's code while the request's projectCode doesn't match.","commonSituations":"Triggering via API with a code copied from a different project; workflow deleted before a scheduled trigger fires; wrong projectCode in the URL path; code type confusion (string vs long) mangling the code.","solutions":["Verify the workflow definition code exists and belongs to the project in the request URL","Refresh the workflow list — the definition may have been deleted","Use the workflow's name lookup within the correct project to get the right code","Check that projectCode in the path matches the workflow's owning project"],"exampleFix":"// before\n// POST /projects/wrongProject/executors/start with code of a workflow in otherProject\n// after\n// POST /projects/correctProject/executors/start with the workflow code owned by that project","handlingStrategy":"validation","validationCode":"WorkflowDefinition def = workflowDefinitionDao.queryByCode(workflowCode);\nif (def == null || def.getProjectCode() != projectCode) {\n    throw new IllegalStateException(\"Workflow \" + workflowCode + \" not found in project \" + projectCode);\n}","typeGuard":null,"tryCatchPattern":"try {\n    executorService.triggerWorkflowDefinition(triggerRequest);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.WORKFLOW_DEFINITION_NOT_EXIST.getCode()) {\n        // look up current code from project's workflow list and retry\n    } else { throw e; }\n}","preventionTips":["Resolve workflow codes by name within the target project, don't hardcode","Keep trigger automation in sync with workflow deletions/renames","Verify projectCode in the URL matches the workflow's owning project"],"tags":["dolphinscheduler","workflow","not-found","project-scope"],"backgroundTag":"entity-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"}