{"record":{"id":"bf9ebed938545f6a","repo":"apache/dolphinscheduler","slug":"1401001","errorCode":"1401001","errorMessage":"You can not modify or remove this worker group, cause it has [{0}] dependent workflow timings like :{1}","messagePattern":"You can not modify or remove this worker group, cause it has \\[(.+?)\\] dependent workflow timings like :(.+?)","errorType":"exception","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java","lineNumber":178,"sourceCode":"        // check if the worker group has any dependent tasks\n        List<TaskDefinition> taskDefinitions = taskDefinitionDao.queryByWorkerGroup(workerGroup.getName());\n\n        if (CollectionUtils.isNotEmpty(taskDefinitions)) {\n            List<String> taskNames = taskDefinitions.stream().limit(3).map(TaskDefinition::getName)\n                    .collect(Collectors.toList());\n            throw new ServiceException(Status.WORKER_GROUP_DEPENDENT_TASK_EXISTS, taskDefinitions.size(),\n                    JSONUtils.toJsonString(taskNames));\n        }\n\n        // check if the worker group has any dependent schedulers\n        List<Schedule> schedules = scheduleDao.queryScheduleByWorkerGroup(workerGroup.getName());\n\n        if (CollectionUtils.isNotEmpty(schedules)) {\n            List<String> workflowDefinitionNames = schedules.stream().limit(3)\n                    .map(schedule -> workflowDefinitionDao.queryByCode(schedule.getWorkflowDefinitionCode())\n                            .orElse(null).getName())\n                    .collect(Collectors.toList());\n            throw new ServiceException(Status.WORKER_GROUP_DEPENDENT_SCHEDULER_EXISTS, schedules.size(),\n                    JSONUtils.toJsonString(workflowDefinitionNames));\n        }\n\n        // check if the worker group has any dependent environments\n        List<EnvironmentWorkerGroupRelation> environmentWorkerGroupRelations =\n                environmentWorkerGroupRelationMapper.selectList(new QueryWrapper<EnvironmentWorkerGroupRelation>()\n                        .lambda().eq(EnvironmentWorkerGroupRelation::getWorkerGroup, workerGroup.getName()));\n\n        if (CollectionUtils.isNotEmpty(environmentWorkerGroupRelations)) {\n            throw new ServiceException(Status.WORKER_GROUP_DEPENDENT_ENVIRONMENT_EXISTS,\n                    environmentWorkerGroupRelations.size());\n        }\n    }\n\n    private void checkWorkerGroupAddrList(String workerGroupAddress) {\n        if (Strings.isNullOrEmpty(workerGroupAddress)) {\n            return;\n        }","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java#L160-L196","documentation":"Status.WORKER_GROUP_DEPENDENT_SCHEDULER_EXISTS (1401001) is thrown by checkWorkerGroupDependencies when one or more schedule (workflow timing) records still target the worker group. Deletion is blocked and the message lists the count plus up to three dependent workflow definition names.","triggerScenarios":"Attempting deleteWorkerGroupById while any schedule in t_ds_schedules has the group as its worker group — e.g. online (committed) workflow schedules still pinned to the group.","commonSituations":"Deleting a group whose workflows are still scheduled to run on it; cloned workflows whose schedules inherited the group; decommissioning workers before rescheduling the workflows.","solutions":["Edit each listed workflow's timing/schedule and switch it to another worker group, then retry deletion.","Or take the dependent schedules offline and delete them if they're no longer needed.","Enumerate dependencies beforehand with scheduleDao.queryScheduleByWorkerGroup(groupName) to get the full list.","After all schedules are repointed or removed, re-run deleteWorkerGroupById."],"exampleFix":"// before\nworkerGroupService.deleteWorkerGroupById(loginUser, 7); // schedules still use group\n// after\nList<Schedule> scheds = scheduleDao.queryScheduleByWorkerGroup(\"legacy\");\nscheds.forEach(s -> updateScheduleWorkerGroup(s.getId(), \"default\"));\nworkerGroupService.deleteWorkerGroupById(loginUser, 7);","handlingStrategy":"validation","validationCode":"List<Schedule> scheds = scheduleDao.queryScheduleByWorkerGroup(groupName);\nif (!scheds.isEmpty()) {\n    throw new IllegalStateException(\"repoint \" + scheds.size() + \" schedules before delete\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    workerGroupService.deleteWorkerGroupById(loginUser, id);\n} catch (ServiceException e) {\n    if (e.getCode() == 1401001) {\n        // workflow names are in the message; edit each timing then retry\n    }\n}","preventionTips":["Audit schedules referencing a group before decommissioning it","Repoint or take offline schedules during worker-group migrations","Combine with task-dependency checks (1401000) in one pre-flight","Re-run deletion only after all listed workflows are rescheduled"],"tags":["worker-group","scheduling","dependencies","deletion"],"backgroundTag":"invalid-state-transition","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}