{"record":{"id":"38ee8d61f85a75dd","repo":"apache/dolphinscheduler","slug":"warninggroupid-of-the-workflow-instance-must-not-b","errorCode":null,"errorMessage":"warningGroupId of the workflow instance must not be null","messagePattern":"warningGroupId of the workflow instance must not be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java","lineNumber":209,"sourceCode":"        // we use this method to avoid insert duplicate alert(issue #5525)\n        // we modified this method to optimize performance(issue #9174)\n        Date crashAlarmSuppressionStartTime = Date.from(\n                LocalDateTime.now().plusMinutes(-crashAlarmSuppression).atZone(ZoneId.systemDefault()).toInstant());\n        alertMapper.insertAlertWhenServerCrash(alert, crashAlarmSuppressionStartTime);\n    }\n\n    /**\n     * workflow time out alert\n     *\n     * @param workflowInstance workflowInstance\n     * @param projectUser     projectUser\n     */\n    public void sendWorkflowTimeoutAlert(WorkflowInstance workflowInstance, ProjectUser projectUser) {\n        if (projectUser == null) {\n            throw new IllegalArgumentException(\"projectUser must not be null\");\n        }\n        if (workflowInstance.getWarningGroupId() == null) {\n            throw new IllegalArgumentException(\"warningGroupId of the workflow instance must not be null\");\n        }\n\n        int alertGroupId = workflowInstance.getWarningGroupId();\n        Alert alert = new Alert();\n        List<WorkflowAlertContent> workflowAlertContentList = new ArrayList<>(1);\n        WorkflowAlertContent workflowAlertContent = WorkflowAlertContent.builder()\n                .projectCode(projectUser.getProjectCode())\n                .projectName(projectUser.getProjectName())\n                .owner(projectUser.getUserName())\n                .workflowInstanceId(workflowInstance.getId())\n                .workflowDefinitionCode(workflowInstance.getWorkflowDefinitionCode())\n                .workflowInstanceName(workflowInstance.getName())\n                .commandType(workflowInstance.getCommandType())\n                .workflowExecutionStatus(workflowInstance.getState())\n                .runTimes(workflowInstance.getRunTimes())\n                .workflowStartTime(workflowInstance.getStartTime())\n                .workflowHost(workflowInstance.getHost())\n                .event(AlertEvent.TIME_OUT)","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java#L191-L227","documentation":"sendWorkflowTimeoutAlert() uses workflowInstance.getWarningGroupId() as the alert group; if it is null the method cannot determine which alert group to notify and throws IllegalArgumentException. A valid warning group must be set on the workflow definition before the instance runs.","triggerScenarios":"Triggering a workflow timeout alert for an instance whose workflow definition has no warning group configured (warningGroupId is NULL in the workflow definition / instance), e.g. the definition was saved without selecting an alert group.","commonSituations":"Workflows created via API or import without a warningGroupId; older workflow definitions predating the warning-group requirement; UI race where timeout fires for a definition saved with empty alert group.","solutions":["Set a warning group (alert group) on the workflow definition in the UI/API and re-save.","Backfill warning_group_id for affected workflow definitions in the database.","In callers, check workflowInstance.getWarningGroupId() != null before invoking the alert.","Configure a default alert group for workflows so new definitions always have one."],"exampleFix":"// before\nalertDao.sendWorkflowTimeoutAlert(workflowInstance, projectUser);\n// after\nif (workflowInstance.getWarningGroupId() != null) {\n    alertDao.sendWorkflowTimeoutAlert(workflowInstance, projectUser);\n}","handlingStrategy":"validation","validationCode":"if (workflowInstance.getWarningGroupId() == null) {\n    log.warn(\"Workflow {} has no warning group; skip timeout alert\", workflowInstance.getId());\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    alertDao.sendWorkflowTimeoutAlert(workflowInstance, projectUser);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Alert not sent: {}\", e.getMessage());\n}","preventionTips":["Require an alert group when saving workflow definitions.","Audit workflow_definition rows for NULL warning_group_id.","Set a default alert group in deployment automation."],"tags":["alerting","missing-config","workflow"],"backgroundTag":"missing-required-config-field","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"}