apache/dolphinscheduler · warning · IllegalArgumentException

projectUser must not be null

Error message

projectUser must not be null

What it means

AlertDao.sendWorkflowTimeoutAlert() requires the ProjectUser of the workflow's owner to construct the alert content (project name, user name). If a null ProjectUser is passed, it immediately fails fast with IllegalArgumentException rather than producing a partial alert.

Source

Thrown at dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java:206

        alert.setUpdateTime(new Date());
        alert.setAlertType(AlertType.FAULT_TOLERANCE_WARNING);
        alert.setSign(generateSign(alert));
        // we use this method to avoid insert duplicate alert(issue #5525)
        // we modified this method to optimize performance(issue #9174)
        Date crashAlarmSuppressionStartTime = Date.from(
                LocalDateTime.now().plusMinutes(-crashAlarmSuppression).atZone(ZoneId.systemDefault()).toInstant());
        alertMapper.insertAlertWhenServerCrash(alert, crashAlarmSuppressionStartTime);
    }

    /**
     * workflow time out alert
     *
     * @param workflowInstance workflowInstance
     * @param projectUser     projectUser
     */
    public void sendWorkflowTimeoutAlert(WorkflowInstance workflowInstance, ProjectUser projectUser) {
        if (projectUser == null) {
            throw new IllegalArgumentException("projectUser must not be null");
        }
        if (workflowInstance.getWarningGroupId() == null) {
            throw new IllegalArgumentException("warningGroupId of the workflow instance must not be null");
        }

        int alertGroupId = workflowInstance.getWarningGroupId();
        Alert alert = new Alert();
        List<WorkflowAlertContent> workflowAlertContentList = new ArrayList<>(1);
        WorkflowAlertContent workflowAlertContent = WorkflowAlertContent.builder()
                .projectCode(projectUser.getProjectCode())
                .projectName(projectUser.getProjectName())
                .owner(projectUser.getUserName())
                .workflowInstanceId(workflowInstance.getId())
                .workflowDefinitionCode(workflowInstance.getWorkflowDefinitionCode())
                .workflowInstanceName(workflowInstance.getName())
                .commandType(workflowInstance.getCommandType())
                .workflowExecutionStatus(workflowInstance.getState())
                .runTimes(workflowInstance.getRunTimes())

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Ensure the caller fetches ProjectUser via the project code and handles a null result before calling sendWorkflowTimeoutAlert.
  2. Check the project_code of the workflow instance exists in the project table.
  3. Skip or degrade the timeout alert when the project/user no longer exists instead of passing null.
  4. Verify the mapping/query used to build ProjectUser returns all fields.

Example fix

// before
alertDao.sendWorkflowTimeoutAlert(workflowInstance, projectUser); // may be null
// after
if (projectUser != null) {
    alertDao.sendWorkflowTimeoutAlert(workflowInstance, projectUser);
}
Defensive patterns

Strategy: validation

Validate before calling

if (projectUser == null) {
    log.warn("Skip workflow timeout alert: no project user for instance {}", workflowInstance.getId());
    return;
}

Type guard

boolean hasProjectUser(WorkflowInstance wf, ProjectUser pu) { return pu != null; }

Try / catch

try {
    alertDao.sendWorkflowTimeoutAlert(workflowInstance, projectUser);
} catch (IllegalArgumentException e) {
    log.warn("Workflow timeout alert skipped: {}", e.getMessage());
}

Prevention

When it happens

Trigger: A caller (e.g. workflow timeout warning handling in the master/worker alert path) queries the project/user and receives null (project deleted, user removed, or query on wrong projectCode), then passes it to sendWorkflowTimeoutAlert.

Common situations: Workflow instance belongs to a project that was deleted while the instance was still running; user account removed; refactored caller passing an unpopulated object; DB lookups returning null for orphaned workflow instances.

Related errors


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