apache/dolphinscheduler · error · ServiceException
user %s doesn't exist
Error message
user %s doesn't exist
What it means
PermissionCheck.checkPermission looks up the User by userId via processService.getUserById before evaluating authorization. If no user row matches the id it throws a ServiceException 'user <id> doesn't exist'. Called from guarded API paths such as releasing a task definition.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/permission/PermissionCheck.java:78
this.processService = processService;
this.needChecks = needChecks;
this.userId = userId;
this.logger = logger;
}
/**
* check permission
*
* @throws ServiceException exception
*/
public void checkPermission() throws ServiceException {
if (this.needChecks.length > 0) {
// get user type in order to judge whether the user is admin
User user = processService.getUserById(userId);
if (user == null) {
logger.error("User does not exist, userId:{}.", userId);
throw new ServiceException(String.format("user %s doesn't exist", userId));
}
if (user.getUserType() != UserType.ADMIN_USER) {
List<T> unauthorizedList = processService.listUnauthorized(userId, needChecks, authorizationType);
// if exist unauthorized resource
if (CollectionUtils.isNotEmpty(unauthorizedList)) {
logger.error("User does not have {} permission for {}, userName:{}.",
authorizationType.getDescp(), unauthorizedList, user.getUserName());
throw new ServiceException(String.format("user %s doesn't have permission of %s %s",
user.getUserName(), authorizationType.getDescp(), unauthorizedList.get(0)));
}
}
}
}
}
View on GitHub (pinned to 02eac45a1b)
Solutions
- Log in again / refresh the session so a valid userId is used
- Verify the user exists: query t_ds_user for the id (SELECT * FROM t_ds_user WHERE id=<id>)
- If users were deleted, clean up references (schedules, releases, tokens) pointing to the removed id
- Recreate the deleted user account if historical references must stay valid
Example fix
// before
permissionCheck.checkPermission(userId, ...);
// after: guard on caller side
User user = usersService.queryUser(userId);
if (user == null) { throw new ServiceException("user " + userId + " doesn't exist"); }
permissionCheck.checkPermission(userId, ...); Defensive patterns
Strategy: validation
Validate before calling
// before invoking guarded API
User user = usersService.queryUser(userId);
if (user == null) {
throw new ServiceException("user " + userId + " doesn't exist - re-login");
} Type guard
boolean userExists(int userId) {
return userId > 0 && processService.getUserById(userId) != null;
} Try / catch
try {
permissionCheck.checkPermission(userId, needChecks, authorizationType);
} catch (ServiceException e) {
if (e.getMessage().endsWith("doesn't exist")) {
log.warn("stale userId {}, forcing re-authentication", userId);
throw new ServiceStatusHttpException(Status.USER_NOT_EXIST, e);
}
throw e;
} Prevention
- Invalidate sessions/tokens when a user is deleted
- Never accept userId=0 or negative ids from clients
- Clean up orphaned references after user deletion
- Re-fetch the user from DB on each privileged request rather than caching
When it happens
Trigger: An API request (e.g. releaseTaskDefinition) passes a userId with no matching record in t_ds_user - the user was deleted while the caller still holds their id, or an id of 0/invalid value is passed.
Common situations: Stale client sessions after an admin deleted the user; manually forged requests with arbitrary ids; data migration leaving orphaned ids in request payloads.
Understand the failure class
Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.
Related errors
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/24a95079db93da85.
Report an issue: GitHub.