apache/dolphinscheduler · error · IllegalArgumentException

Can not find valid project by name %s

Error message

Can not find valid project by name %s

What it means

getDependentInfo resolves a project by name via projectDao.queryByName; a null result (no project with that name) throws IllegalArgumentException. Dependent task resolution needs the project code to find the referenced workflow/task.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java:559

        return result;
    }

    /**
     * Get project, workflow, task code.
     * Useful in Python API create dependent task which need workflow information.
     *
     * @param projectName  project name which workflow belongs to
     * @param workflowName workflow name
     * @param taskName     task name
     */
    public Map<String, Object> getDependentInfo(String projectName, String workflowName, String taskName) {
        Map<String, Object> result = new HashMap<>();

        Project project = projectDao.queryByName(projectName);
        if (project == null) {
            String msg = String.format("Can not find valid project by name %s", projectName);
            log.error(msg);
            throw new IllegalArgumentException(msg);
        }
        long projectCode = project.getCode();
        result.put("projectCode", projectCode);

        WorkflowDefinition workflowDefinition =
                workflowDefinitionDao.queryByDefineName(projectCode, workflowName);
        if (workflowDefinition == null) {
            String msg = String.format("Can not find valid workflow by name %s", workflowName);
            log.error(msg);
            throw new IllegalArgumentException(msg);
        }
        result.put("workflowDefinitionCode", workflowDefinition.getCode());

        if (taskName != null) {
            TaskDefinition taskDefinition =
                    taskDefinitionDao.queryByName(projectCode, workflowDefinition.getCode(), taskName);
            result.put("taskDefinitionCode", taskDefinition.getCode());
        }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Verify the project name in the web UI Project list and use it exactly in the Python script
  2. Create the project if it does not exist in this instance
  3. Fix typos / trailing whitespace in projectName
  4. If cross-instance, switch the Python script to the correct environment

Example fix

// before (Python)
dependent = Dependent(project_name="DW", workflow_name="daily_etl")
// after
dependent = Dependent(project_name="data-warehouse", workflow_name="daily_etl")  # exact project name
Defensive patterns

Strategy: validation

Validate before calling

Project project = projectDao.queryByName(projectName);
if (project == null) {
    throw new IllegalStateException("Project does not exist: " + projectName);
}

Try / catch

try {
    pythonGateway.getDependentInfo(projectName, workflowName, taskName);
} catch (IllegalArgumentException e) {
    log.error("Project/workflow lookup failed: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling getDependentInfo(projectName, workflowName, ...) with a project name that has no matching row in the project table.

Common situations: pydolphinscheduler dependent tasks pointing at a project in another instance; project deleted; project renamed; case-sensitivity/whitespace mismatch in the name.

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


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/4c9f0b00883bbb21. Report an issue: GitHub.