apache/dolphinscheduler · error · ServiceException
WORKFLOW_DEFINITION_NOT_EXIST
WORKFLOW_DEFINITION_NOT_EXIST
Error message
WORKFLOW_DEFINITION_NOT_EXIST
What it means
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.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java:133
@Autowired
private BackfillWorkflowRequestTransformer backfillWorkflowRequestTransformer;
@Autowired
private BackfillWorkflowDTOValidator backfillWorkflowDTOValidator;
@Autowired
private ExecutorClient executorClient;
@Override
@Transactional
public Integer triggerWorkflowDefinition(final WorkflowTriggerRequest triggerRequest) {
projectService.checkHasProjectWritePermissionThrowException(
triggerRequest.getLoginUser(), triggerRequest.getProjectCode());
final TriggerWorkflowDTO triggerWorkflowDTO = triggerWorkflowRequestTransformer.transform(triggerRequest);
// verify the workflow definition belongs to the URL's project
if (triggerWorkflowDTO.getWorkflowDefinition() == null
|| triggerWorkflowDTO.getWorkflowDefinition().getProjectCode() != triggerRequest.getProjectCode()) {
throw new ServiceException(Status.WORKFLOW_DEFINITION_NOT_EXIST,
String.valueOf(triggerRequest.getWorkflowDefinitionCode()));
}
// todo: use validator chain
triggerWorkflowDTOValidator.validate(triggerWorkflowDTO);
return executorClient.triggerWorkflowDefinition().execute(triggerWorkflowDTO);
}
@Override
@Transactional
public List<Integer> backfillWorkflowDefinition(final WorkflowBackFillRequest workflowBackFillRequest) {
projectService.checkHasProjectWritePermissionThrowException(
workflowBackFillRequest.getLoginUser(), workflowBackFillRequest.getProjectCode());
final BackfillWorkflowDTO backfillWorkflowDTO =
backfillWorkflowRequestTransformer.transform(workflowBackFillRequest);
// verify the workflow definition belongs to the URL's project
if (backfillWorkflowDTO.getWorkflowDefinition() == null
|| backfillWorkflowDTO.getWorkflowDefinition().getProjectCode() != workflowBackFillRequest
.getProjectCode()) {View on GitHub (pinned to 02eac45a1b)
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
Example fix
// before // POST /projects/wrongProject/executors/start with code of a workflow in otherProject // after // POST /projects/correctProject/executors/start with the workflow code owned by that project
Defensive patterns
Strategy: validation
Validate before calling
WorkflowDefinition def = workflowDefinitionDao.queryByCode(workflowCode);
if (def == null || def.getProjectCode() != projectCode) {
throw new IllegalStateException("Workflow " + workflowCode + " not found in project " + projectCode);
} Try / catch
try {
executorService.triggerWorkflowDefinition(triggerRequest);
} catch (ServiceException e) {
if (e.getCode() == Status.WORKFLOW_DEFINITION_NOT_EXIST.getCode()) {
// look up current code from project's workflow list and retry
} else { throw e; }
} Prevention
- 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
When it happens
Trigger: POST trigger with a workflowDefinitionCode that doesn't exist, or exists under another project's code while the request's projectCode doesn't match.
Common situations: 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.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Can not find valid workflow by name %s
- QUERY_ENVIRONMENT_BY_CODE_ERROR
- QUERY_ENVIRONMENT_BY_NAME_ERROR
- WORKFLOW_DEFINITION_NOT_RELEASE
- SUB_WORKFLOW_DEFINITION_NOT_RELEASE
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/ea571d689316e3d0.
Report an issue: GitHub.