apache/dolphinscheduler · error · ServiceException

130001

130001

Error message

this task group name is repeated in a project

What it means

createTaskGroup checks taskGroupMapper.queryByName(loginUser.getId(), name) and throws Status.TASK_GROUP_NAME_EXSIT (code 130001) if a group with the same name already exists for this user. Names are unique per user, so duplicate creation is rejected.

Source

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

    @Transactional
    public TaskGroup createTaskGroup(User loginUser, Long projectCode, String name, String description, int groupSize) {
        requireProjectPerm(loginUser, projectCode, true);
        if (checkDescriptionLength(description)) {
            log.warn("Parameter description is too long.");
            throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR);
        }
        if (name == null) {
            log.warn("Parameter name can ot be null.");
            throw new ServiceException(Status.NAME_NULL);
        }
        if (groupSize <= 0) {
            log.warn("Parameter task group size is must bigger than 1.");
            throw new ServiceException(Status.TASK_GROUP_SIZE_ERROR);
        }
        TaskGroup duplicate = taskGroupMapper.queryByName(loginUser.getId(), name);
        if (duplicate != null) {
            log.warn("Task group with the same name already exists, taskGroupName:{}.", duplicate.getName());
            throw new ServiceException(Status.TASK_GROUP_NAME_EXSIT);
        }
        Date now = new Date();
        TaskGroup taskGroup = TaskGroup.builder()
                .name(name)
                .projectCode(projectCode)
                .description(description)
                .groupSize(groupSize)
                .userId(loginUser.getId())
                .status(Flag.YES)
                .createTime(now)
                .updateTime(now)
                .build();

        if (taskGroupMapper.insert(taskGroup) <= 0) {
            log.error("Create task group error, taskGroupName:{}.", taskGroup.getName());
            throw new ServiceException(Status.CREATE_TASK_GROUP_ERROR);
        }
        log.info("Create task group complete, taskGroupName:{}.", taskGroup.getName());

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Choose a unique name for the new task group (unique per user).
  2. Query existing groups first and reuse/update the existing group instead of creating a new one.
  3. Make creation idempotent by checking name existence before calling the API.

Example fix

// before
apiClient.createTaskGroup(user, projectCode, "etl-group", desc, 10); // second run fails
// after
if (apiClient.findGroupByName(user, "etl-group") == null) {
    apiClient.createTaskGroup(user, projectCode, "etl-group", desc, 10);
}
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = api.listTaskGroups(u).stream()
    .anyMatch(g -> g.getName().equals(name));
if (exists) { /* reuse or rename before creating */ }

Try / catch

try { api.createTaskGroup(u, pc, name, desc, size); }
catch (ServiceException e) { if (e.getCode() == 130001) { reuseOrCreateWithSuffix(name); } }

Prevention

When it happens

Trigger: POST /task-group/update-or-create (create path) where the authenticated user already owns a task group with the identical name; retrying a creation after a previous success.

Common situations: Idempotency-unaware retry logic re-posting the same request; two admins creating similarly named groups; import scripts run twice without deduplication.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


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