{"record":{"id":"223576cb8321a676","repo":"apache/dolphinscheduler","slug":"10174","errorCode":"10174","errorMessage":"delete worker group not exist ","messagePattern":"delete worker group not exist ","errorType":"exception","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java","lineNumber":322,"sourceCode":"                    return workerGroupPageDetail;\n                }).collect(Collectors.toList());\n    }\n\n    /**\n     * delete worker group by id\n     *\n     * @param id worker group id\n     */\n    @Override\n    @Transactional\n    public void deleteWorkerGroupById(User loginUser, Integer id) {\n        if (!canOperatorPermissions(loginUser, null, AuthorizationType.WORKER_GROUP, WORKER_GROUP_DELETE)) {\n            throw new ServiceException(Status.USER_NO_OPERATION_PERM);\n        }\n        WorkerGroup workerGroup = workerGroupDao.queryById(id);\n        if (workerGroup == null) {\n            log.error(\"Worker group does not exist, workerGroupId:{}.\", id);\n            throw new ServiceException(Status.DELETE_WORKER_GROUP_NOT_EXIST);\n        }\n        List<WorkflowInstanceSummaryDto> workflowInstances = workflowInstanceDao.queryByWorkerGroupNameAndStatus(\n                workerGroup.getName(),\n                WorkflowExecutionStatus.NOT_TERMINAL_STATES);\n        if (CollectionUtils.isNotEmpty(workflowInstances)) {\n            List<Integer> workflowInstanceIds =\n                    workflowInstances.stream().map(WorkflowInstanceSummaryDto::getId).collect(Collectors.toList());\n            log.warn(\n                    \"Delete worker group failed because there are {} workflowInstances are using it, workflowInstanceIds:{}.\",\n                    workflowInstances.size(), workflowInstanceIds);\n            throw new ServiceException(Status.DELETE_WORKER_GROUP_BY_ID_FAIL, workflowInstances.size());\n        }\n\n        checkWorkerGroupDependencies(workerGroup);\n\n        workerGroupDao.deleteById(id);\n        boardCastToMasterThatWorkerGroupChanged();\n","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java#L304-L340","documentation":"Thrown in WorkerGroupServiceImpl.deleteWorkerGroupById when workerGroupDao.queryById(id) returns null: the worker-group id being deleted does not exist in t_ds_worker_group, typically because it was already removed or the client passed a stale/nonexistent id.","triggerScenarios":"Calling DELETE /worker-groups/{id} with an id that is absent from t_ds_worker_group (deleted by another user/session, wrong id, or UI stale after concurrent deletion).","commonSituations":"Double-clicking delete so the second request finds nothing; scripted cleanup reusing old ids; deleting across environments (test vs prod database) with copied ids.","solutions":["Refresh the worker group list and confirm the id still exists before deleting.","Check the response of the prior delete call; the group may already be gone and this error is benign for idempotent cleanup.","Correct the id in the script/UI call."],"exampleFix":"// before: blind delete\nDELETE /worker-groups/{id}\n// after: check existence first\nWorkerGroup g = workerGroupDao.queryById(id);\nif (g != null) workerGroupService.deleteWorkerGroupById(loginUser, id);","handlingStrategy":"validation","validationCode":"WorkerGroup g = workerGroupDao.queryById(id);\nboolean exists = g != null;","typeGuard":null,"tryCatchPattern":"try {\n    workerGroupService.deleteWorkerGroupById(loginUser, id);\n} catch (ServiceException e) {\n    if (e.getCode() == 10174) { /* treat as already-deleted (idempotent) */ }\n    else throw e;\n}","preventionTips":["Re-fetch the group list before each delete in scripts instead of caching ids.","Make bulk cleanup idempotent: ignore 10174 as success.","Avoid double-submit delete requests from UI clients."],"tags":["worker-group","not-found","delete"],"backgroundTag":"record-not-found","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"}