theonedev/onedev · error · ExplicitException

Unable to find user with login: ${userName}

Error message

Unable to find user with login: ${userName}

What it means

UserMatch.getUserMatchCriteria resolves each 'user:<name>' criterion via UserService.findByName; if the user cannot be found it throws ExplicitException with the offending login. UserMatch.parse therefore rejects any match expression referencing a nonexistent user.

Source

Thrown at server-core/src/main/java/io/onedev/server/util/usermatch/UserMatch.java:73

				return false;
		}
		for (UserMatchCriteria criteria: criterias) {
			if (criteria.matches(user))
				return true;
		}
		return false;
	}
	
	private static UserMatchCriteria getUserMatchCriteria(CriteriaContext criteriaContext) {
		if (criteriaContext.Anyone() != null) {
			return new Anyone();
		} else if (criteriaContext.userCriteria() != null) {
			String userName = getValue(criteriaContext.userCriteria().Value());
			User user = OneDev.getInstance(UserService.class).findByName(userName);
			if (user != null)
				return new UserCriteria(user);
			else
				throw new ExplicitException("Unable to find user with login: " + userName);
		} else if (criteriaContext.groupCriteria() != null) {
			String groupName = getValue(criteriaContext.groupCriteria().Value());
			Group group = OneDev.getInstance(GroupService.class).find(groupName);
			if (group != null)
				return new GroupCriteria(group);
			else
				throw new ExplicitException("Unable to find group: " + groupName);
		} else {
			throw new ExplicitException("Unrecognized user match criteria");
		}
	}
	
	public static UserMatch parse(@Nullable String userMatchString) {
		List<UserMatchCriteria> criterias = new ArrayList<>();
		List<UserMatchCriteria> exceptCriterias = new ArrayList<>();
		
		if (userMatchString != null) {
			CharStream is = CharStreams.fromString(userMatchString); 

View on GitHub (pinned to d44925c47c)

Solutions

  1. Fix the user login in the match string to an existing user
  2. Replace the user clause with a group clause that still exists
  3. Validate via UserMatch.parse in a try-catch before persisting the configuration

Example fix

// before
userMatchString = "user:alice2";
// after
userMatchString = "user:alice";
Defensive patterns

Strategy: validation

Validate before calling

User user = OneDev.getInstance(UserService.class).findByName(login);
if (user == null)
    throw new ExplicitException("Unknown user in match: " + login);

Try / catch

try {
    UserMatch.parse(matchString);
} catch (ExplicitException e) {
    ui.showError(e.getMessage());
}

Prevention

When it happens

Trigger: Parsing a user match string (e.g. for job executors or authorizations) containing a user login that does not exist, such as 'user:alice2' when only 'alice' exists.

Common situations: User renamed or removed after the match string was saved; config copied between instances; typo or wrong-case login.

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 theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/93cb1bc1977c36cd. Report an issue: GitHub.