apache/dolphinscheduler · error · ServiceException
10135
10135
Error message
name {0} already exists What it means
Status.NAME_EXIST (10135) is thrown when the worker group name collides with an existing row — saveWorkerGroup catches Spring's DuplicateKeyException from the insert/update (unique key on worker-group name) and rethrows it as a friendly 'name already exists' error.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java:151
workerGroup.setUpdateTime(now);
workerGroup.setDescription(description);
workerGroupDao.insert(workerGroup);
} else {
workerGroup = workerGroupDao.queryById(id);
if (workerGroup == null) {
throw new ServiceException(Status.WORKER_GROUP_NOT_EXIST, id);
}
workerGroup.setName(name);
workerGroup.setAddrList(addrList);
workerGroup.setUpdateTime(now);
workerGroup.setDescription(description);
workerGroupDao.updateById(workerGroup);
log.info("Update worker group: {} success .", workerGroup);
}
boardCastToMasterThatWorkerGroupChanged();
return workerGroup;
} catch (DuplicateKeyException duplicateKeyException) {
throw new ServiceException(Status.NAME_EXIST, name);
}
}
/**
* check if the worker group has any dependent tasks, schedulers or environments;
* throws ServiceException with the matching status if any dependency is found.
*/
private void checkWorkerGroupDependencies(WorkerGroup workerGroup) {
// check if the worker group has any dependent tasks
List<TaskDefinition> taskDefinitions = taskDefinitionDao.queryByWorkerGroup(workerGroup.getName());
if (CollectionUtils.isNotEmpty(taskDefinitions)) {
List<String> taskNames = taskDefinitions.stream().limit(3).map(TaskDefinition::getName)
.collect(Collectors.toList());
throw new ServiceException(Status.WORKER_GROUP_DEPENDENT_TASK_EXISTS, taskDefinitions.size(),
JSONUtils.toJsonString(taskNames));
}
View on GitHub (pinned to 02eac45a1b)
Solutions
- Choose a different, unique name for the worker group.
- Check existing groups first (queryByName / list API) and update the existing group instead of creating a duplicate.
- Make scripts idempotent: look up by name, update if present, create only if absent.
- Trim/case-normalize names before comparison to avoid near-duplicates.
Example fix
// before workerGroupService.saveWorkerGroup(loginUser, 0, "default", "ip:1234", ""); // exists // after WorkerGroup g = workerGroupService.queryByName(loginUser, "default"); workerGroupService.saveWorkerGroup(loginUser, g == null ? 0 : g.getId(), "default", "ip:1234", "");
Defensive patterns
Strategy: try-catch
Validate before calling
boolean exists = workerGroupService.queryByName(loginUser, name) != null;
if (exists) { /* update instead of create, or pick another name */ } Try / catch
try {
workerGroupService.saveWorkerGroup(loginUser, id, name, addrList, desc);
} catch (ServiceException e) {
if (e.getCode() == 10135) { /* name collision: rename or update existing */ }
} Prevention
- Check for existing names before creating
- Make provisioning scripts idempotent (lookup-then-update)
- Use distinct, environment-prefixed group names
- Avoid near-duplicate names differing only by case/whitespace
When it happens
Trigger: Creating a worker group with a name that already exists (insert duplicate key), or renaming a group to a name used by another group (update duplicate key).
Common situations: Two admins creating the same group concurrently; re-running a provisioning script without idempotency; case/whitespace differences that normalize to the same name in the DB unique index.
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/1b57314810e5d38c.
Report an issue: GitHub.