theonedev/onedev · error · ExplicitException
Unable to find user '${userName}'
Error message
Unable to find user '${userName}' What it means
During review requirement parsing, a 'user:<name>' criterion whose name cannot be resolved by UserService.findByName throws ExplicitException. The requirement cannot be evaluated if a referenced user does not exist.
Source
Thrown at server-core/src/main/java/io/onedev/server/util/reviewrequirement/ReviewRequirement.java:64
});
CommonTokenStream tokens = new CommonTokenStream(lexer);
ReviewRequirementParser parser = new ReviewRequirementParser(tokens);
parser.removeErrorListeners();
parser.setErrorHandler(new BailErrorStrategy());
RequirementContext requirementContext = parser.requirement();
for (CriteriaContext criteria: requirementContext.criteria()) {
if (criteria.userCriteria() != null) {
String userName = getValue(criteria.userCriteria().Value());
User user = OneDev.getInstance(UserService.class).findByName(userName);
if (user != null) {
if (!users.contains(user))
users.add(user);
else
throw new ExplicitException("User '" + userName + "' is included multiple times");
} else {
throw new ExplicitException("Unable to find user '" + userName + "'");
}
} else if (criteria.groupCriteria() != null) {
String groupName = getValue(criteria.groupCriteria().Value());
Group group = OneDev.getInstance(GroupService.class).find(groupName);
if (group != null) {
if (!groups.containsKey(group)) {
TerminalNode digit = criteria.groupCriteria().DIGIT();
if (digit != null)
groups.put(group, Integer.parseInt(digit.getText()));
else
groups.put(group, 1);
} else {
throw new ExplicitException("Group '" + groupName + "' is included multiple times");
}
} else {
throw new ExplicitException("Unable to find group '" + groupName + "'");
}
}View on GitHub (pinned to d44925c47c)
Solutions
- Correct the user login in the requirement string to an existing user
- Recreate the referenced user or update the requirement to a group instead
- Catch ExplicitException during config save to validate the requirement before persisting
Example fix
// before reviewRequirement = "user:bobb"; // after reviewRequirement = "user:bob";
Defensive patterns
Strategy: validation
Validate before calling
UserService userService = OneDev.getInstance(UserService.class);
for (String name : extractUserNames(requirement)) {
if (userService.findByName(name) == null)
throw new ExplicitException("Unknown user in requirement: " + name);
} Try / catch
try {
ReviewRequirement.parse(req);
} catch (ExplicitException e) {
ui.showError(e.getMessage());
} Prevention
- Pick users via a user picker that only offers existing accounts
- Re-validate requirements when users are deleted or renamed
- Use group criteria to reduce dependence on individual logins
When it happens
Trigger: Parsing a requirement referencing a user login that does not exist (renamed, deleted, or typo), e.g. 'user:bobb'.
Common situations: User deleted or renamed after the requirement was configured; copied config from another OneDev instance; case/whitespace mismatch in the login name.
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
- User '${userName}' is included multiple times
- Group '${groupName}' is included multiple times
- Unable to find group '${groupName}'
- Unable to find user with login: ${userName}
- Title is required
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/677220d56b0fdc6f.
Report an issue: GitHub.