theonedev/onedev · error · ExplicitException

Unable to find group: ${groupName}

Error message

Unable to find group: ${groupName}

What it means

UserMatch.getUserMatchCriteria resolves each 'group:<name>' criterion via GroupService.find; an unresolvable group throws ExplicitException with the group name. UserMatch.parse cannot build criteria for a nonexistent group.

Source

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

	}
	
	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); 
			UserMatchLexer lexer = new UserMatchLexer(is);
			lexer.removeErrorListeners();
			lexer.addErrorListener(new BaseErrorListener() {

				@Override
				public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line,
						int charPositionInLine, String msg, RecognitionException e) {

View on GitHub (pinned to d44925c47c)

Solutions

  1. Correct the group name in the match string
  2. Recreate the group or substitute an existing group/user clause
  3. Run UserMatch.parse on the string before saving settings to fail fast

Example fix

// before
userMatchString = "group:devops-team";
// after
userMatchString = "group:devops";
Defensive patterns

Strategy: validation

Validate before calling

Group group = OneDev.getInstance(GroupService.class).find(groupName);
if (group == null)
    throw new ExplicitException("Unknown group in match: " + groupName);

Try / catch

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

Prevention

When it happens

Trigger: Parsing a user match expression referencing a deleted, renamed, or misspelled group, e.g. 'group:devops-team' after that group was removed.

Common situations: Group deletion without updating user match settings; cross-instance config import; trailing whitespace in group name.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/68e222ca106524f9. Report an issue: GitHub.