apache/dolphinscheduler · error · ServiceException

130009

130009

Error message

update task group list error

What it means

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).

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java:154

                .ne(TaskGroup::getId, id));

        if (exists > 0) {
            log.error("Task group with the same name already exists.");
            throw new ServiceException(Status.TASK_GROUP_NAME_EXSIT);
        }
        if (taskGroup.getStatus() != Flag.YES) {
            log.warn("Task group has been closed, taskGroupId:{}.", id);
            throw new ServiceException(Status.TASK_GROUP_STATUS_ERROR);
        }
        taskGroup.setGroupSize(groupSize);
        taskGroup.setDescription(description);
        taskGroup.setUpdateTime(new Date());
        if (StringUtils.isNotEmpty(name)) {
            taskGroup.setName(name);
        }
        if (taskGroupMapper.updateById(taskGroup) <= 0) {
            log.error("Update task group error, taskGroupId:{}.", id);
            throw new ServiceException(Status.UPDATE_TASK_GROUP_ERROR);
        }
        log.info("Update task group complete, taskGroupId:{}.", id);
        return taskGroup;
    }

    @Override
    public PageInfo<TaskGroup> queryAllTaskGroup(User loginUser, String name, Integer status, int pageNo,
                                                 int pageSize) {
        return this.doQuery(loginUser, pageNo, pageSize, loginUser.getId(), name, status);
    }

    @Override
    public PageInfo<TaskGroup> queryTaskGroupByStatus(User loginUser, int pageNo, int pageSize, int status) {
        return this.doQuery(loginUser, pageNo, pageSize, loginUser.getId(), null, status);
    }

    @Override
    public PageInfo<TaskGroup> queryTaskGroupByProjectCode(User loginUser, int pageNo, int pageSize, Long projectCode) {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Verify the taskGroupId exists before updating: GET /task-group/list-paging and confirm the id.
  2. Re-fetch the task group right before updating and handle 'not found' distinctly from 'update failed'.
  3. Check task_group table (SELECT * FROM t_ds_task_group WHERE id=?) to confirm the row still exists.
  4. Check API server logs for 'Update task group error, taskGroupId:{}' and any underlying SQL exceptions.

Example fix

// before
if (taskGroupMapper.updateById(taskGroup) <= 0) {
    throw new ServiceException(Status.UPDATE_TASK_GROUP_ERROR);
}
// after
TaskGroup current = taskGroupMapper.selectById(id);
if (current == null) {
    throw new ServiceException(Status.TASK_GROUP_NOT_EXIST, id);
}
if (taskGroupMapper.updateById(taskGroup) <= 0) {
    throw new ServiceException(Status.UPDATE_TASK_GROUP_ERROR);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Java: verify the task group exists and capture changed state before updating
TaskGroup tg = taskGroupMapper.selectById(taskGroupId);
if (tg == null) {
    throw new ServiceException(Status.TASK_GROUP_NOT_EXIST, taskGroupId);
}

Type guard

boolean taskGroupExists(int id) {
    return taskGroupMapper.selectById(id) != null;
}

Try / catch

try {
    taskGroupService.updateTaskGroup(loginUser, id, name, description);
} catch (ServiceException e) {
    if (e.getCode() == 130009) {
        // re-fetch the group; if it is gone surface TASK_GROUP_NOT_EXIST instead of a generic update failure
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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