apache/dolphinscheduler · error · ServiceException
10003
10003
Error message
user name already exists
What it means
Thrown by UsersServiceImpl.updateUser when the new userName already belongs to another user: queryByUserNameAccurately finds an existing row whose id differs from the userId being updated. Usernames are unique in t_ds_user, so the rename is rejected with USER_NAME_EXIST. Note the code comment: the check is application-level; a DB unique index is the intended backstop.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java:366
if (!isAdmin(loginUser)) {
if (tenantId != null && user.getTenantId() != tenantId) {
throw new ServiceException(Status.USER_NO_OPERATION_PERM);
}
if (StringUtils.isNotEmpty(queue) && !StringUtils.equals(queue, user.getQueue())) {
throw new ServiceException(Status.USER_NO_OPERATION_PERM);
}
}
if (StringUtils.isNotEmpty(userName)) {
if (!CheckUtils.checkUserName(userName)) {
throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, userName);
}
// todo: use the db unique index
User tempUser = userDao.queryByUserNameAccurately(userName);
if (tempUser != null && !userId.equals(tempUser.getId())) {
throw new ServiceException(Status.USER_NAME_EXIST);
}
user.setUserName(userName);
}
if (StringUtils.isNotEmpty(userPassword)) {
if (!CheckUtils.checkPasswordLength(userPassword)) {
throw new ServiceException(Status.USER_PASSWORD_LENGTH_ERROR);
}
user.setUserPassword(EncryptionUtils.getMd5(userPassword));
sessionService.expireSession(user.getId());
}
if (StringUtils.isNotEmpty(email)) {
if (!CheckUtils.checkEmail(email)) {
throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, email);
}
user.setEmail(email);
}View on GitHub (pinned to 02eac45a1b)
Solutions
- Pick a different userName, or append a suffix to make it unique
- Check the existing user with queryByUserNameAccurately / GET /users to see who owns the name
- If the name belongs to a stale account, delete/deactivate that account first
- Rely on the DB unique constraint catch as a second guard for concurrent renames
Example fix
// before
usersService.updateUser(loginUser, userId, "alice", ...); // 'alice' already exists
// after
if (userDao.queryByUserNameAccurately("alice") != null) {
name = "alice_2"; // or prompt caller for a unique name
}
usersService.updateUser(loginUser, userId, name, ...); Defensive patterns
Strategy: validation
Validate before calling
User existing = userDao.queryByUserNameAccurately(newUserName);
if (existing != null && !existing.getId().equals(userId)) {
throw new IllegalArgumentException("userName '" + newUserName + "' is already taken");
} Try / catch
try {
usersService.updateUser(loginUser, userId, userName, ...);
} catch (ServiceException e) {
if (e.getCode() == Status.USER_NAME_EXIST.getCode()) {
// propose a unique alternative name to the caller
} else { throw e; }
} Prevention
- Check name availability in the UI before submit
- Add unique suffixes in bulk-import pipelines
- Catch DB unique-constraint violations as a backstop for concurrent renames
When it happens
Trigger: Renaming a user to a name taken by another account (or a deleted-but-recreated one); concurrent renames by two admins to the same name; case-sensitivity mismatches if the DB collation is case-insensitive but the Java check is not (or vice versa).
Common situations: LDAP sync colliding with manually created users; restoring exports that reuse names; automation retrying a create that half-succeeded earlier.
Related errors
- ENVIRONMENT_NAME_EXISTS
- The resource is already exist: ${resourceAbsolutePath}
- no master server available
- Backfill workflow failed: %s
- The workflow instance: %s status is %s, can not pause
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/a9a5b502792ae07b.
Report an issue: GitHub.