{"record":{"id":"19abeef6db502100","repo":"apache/dolphinscheduler","slug":"130009","errorCode":"130009","errorMessage":"update task group list error","messagePattern":"update task group list error","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java","lineNumber":154,"sourceCode":"                .ne(TaskGroup::getId, id));\n\n        if (exists > 0) {\n            log.error(\"Task group with the same name already exists.\");\n            throw new ServiceException(Status.TASK_GROUP_NAME_EXSIT);\n        }\n        if (taskGroup.getStatus() != Flag.YES) {\n            log.warn(\"Task group has been closed, taskGroupId:{}.\", id);\n            throw new ServiceException(Status.TASK_GROUP_STATUS_ERROR);\n        }\n        taskGroup.setGroupSize(groupSize);\n        taskGroup.setDescription(description);\n        taskGroup.setUpdateTime(new Date());\n        if (StringUtils.isNotEmpty(name)) {\n            taskGroup.setName(name);\n        }\n        if (taskGroupMapper.updateById(taskGroup) <= 0) {\n            log.error(\"Update task group error, taskGroupId:{}.\", id);\n            throw new ServiceException(Status.UPDATE_TASK_GROUP_ERROR);\n        }\n        log.info(\"Update task group complete, taskGroupId:{}.\", id);\n        return taskGroup;\n    }\n\n    @Override\n    public PageInfo<TaskGroup> queryAllTaskGroup(User loginUser, String name, Integer status, int pageNo,\n                                                 int pageSize) {\n        return this.doQuery(loginUser, pageNo, pageSize, loginUser.getId(), name, status);\n    }\n\n    @Override\n    public PageInfo<TaskGroup> queryTaskGroupByStatus(User loginUser, int pageNo, int pageSize, int status) {\n        return this.doQuery(loginUser, pageNo, pageSize, loginUser.getId(), null, status);\n    }\n\n    @Override\n    public PageInfo<TaskGroup> queryTaskGroupByProjectCode(User loginUser, int pageNo, int pageSize, Long projectCode) {","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java#L136-L172","documentation":"Thrown by TaskGroupServiceImpl.updateTaskGroup when taskGroupMapper.updateById(taskGroup) returns 0, meaning no task group row was updated. Since the task group was fetched by id beforehand, a 0-row update usually means the row no longer exists (deleted concurrently) or the update was rejected. It is reported with status UPDATE_TASK_GROUP_ERROR (code 130009).","triggerScenarios":"Calling PUT task-group/update (TaskGroupController.updateTaskGroup) with a taskGroupId whose row was deleted between fetch and update, or updating with no changed fields on a backend where updateById still reports 0 affected rows; also a DB error swallowed as 0 affected rows.","commonSituations":"Two admins editing the same task group where one deletes it; stale UI holding an id for a removed group; wrong id typed in a script against the /task-group/update endpoint; H2/MySQL connection issues causing the UPDATE to affect nothing.","solutions":["Verify the taskGroupId exists before updating: GET /task-group/list-paging and confirm the id.","Re-fetch the task group right before updating and handle 'not found' distinctly from 'update failed'.","Check task_group table (SELECT * FROM t_ds_task_group WHERE id=?) to confirm the row still exists.","Check API server logs for 'Update task group error, taskGroupId:{}' and any underlying SQL exceptions."],"exampleFix":"// before\nif (taskGroupMapper.updateById(taskGroup) <= 0) {\n    throw new ServiceException(Status.UPDATE_TASK_GROUP_ERROR);\n}\n// after\nTaskGroup current = taskGroupMapper.selectById(id);\nif (current == null) {\n    throw new ServiceException(Status.TASK_GROUP_NOT_EXIST, id);\n}\nif (taskGroupMapper.updateById(taskGroup) <= 0) {\n    throw new ServiceException(Status.UPDATE_TASK_GROUP_ERROR);\n}","handlingStrategy":"try-catch","validationCode":"// Java: verify the task group exists and capture changed state before updating\nTaskGroup tg = taskGroupMapper.selectById(taskGroupId);\nif (tg == null) {\n    throw new ServiceException(Status.TASK_GROUP_NOT_EXIST, taskGroupId);\n}","typeGuard":"boolean taskGroupExists(int id) {\n    return taskGroupMapper.selectById(id) != null;\n}","tryCatchPattern":"try {\n    taskGroupService.updateTaskGroup(loginUser, id, name, description);\n} catch (ServiceException e) {\n    if (e.getCode() == 130009) {\n        // re-fetch the group; if it is gone surface TASK_GROUP_NOT_EXIST instead of a generic update failure\n    }\n    throw e;\n}","preventionTips":["Always verify the task group id exists via the list API before updating.","Reload the entity immediately before the update to shrink the race window.","Handle idempotent 'no rows affected' distinctly from real DB failures.","Watch API server logs for the 'Update task group error' message and underlying SQL errors."],"tags":["task-group","database-update","dolphinscheduler-api"],"backgroundTag":"database-write-failed","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"}