{"record":{"id":"99011237faeda990","repo":"theonedev/onedev","slug":"unrecognized-user-match-criteria","errorCode":null,"errorMessage":"Unrecognized user match criteria","messagePattern":"Unrecognized user match criteria","errorType":"validation","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/util/usermatch/UserMatch.java","lineNumber":82,"sourceCode":"\tprivate static UserMatchCriteria getUserMatchCriteria(CriteriaContext criteriaContext) {\n\t\tif (criteriaContext.Anyone() != null) {\n\t\t\treturn new Anyone();\n\t\t} else if (criteriaContext.userCriteria() != null) {\n\t\t\tString userName = getValue(criteriaContext.userCriteria().Value());\n\t\t\tUser user = OneDev.getInstance(UserService.class).findByName(userName);\n\t\t\tif (user != null)\n\t\t\t\treturn new UserCriteria(user);\n\t\t\telse\n\t\t\t\tthrow new ExplicitException(\"Unable to find user with login: \" + userName);\n\t\t} else if (criteriaContext.groupCriteria() != null) {\n\t\t\tString groupName = getValue(criteriaContext.groupCriteria().Value());\n\t\t\tGroup group = OneDev.getInstance(GroupService.class).find(groupName);\n\t\t\tif (group != null)\n\t\t\t\treturn new GroupCriteria(group);\n\t\t\telse\n\t\t\t\tthrow new ExplicitException(\"Unable to find group: \" + groupName);\n\t\t} else {\n\t\t\tthrow new ExplicitException(\"Unrecognized user match criteria\");\n\t\t}\n\t}\n\t\n\tpublic static UserMatch parse(@Nullable String userMatchString) {\n\t\tList<UserMatchCriteria> criterias = new ArrayList<>();\n\t\tList<UserMatchCriteria> exceptCriterias = new ArrayList<>();\n\t\t\n\t\tif (userMatchString != null) {\n\t\t\tCharStream is = CharStreams.fromString(userMatchString); \n\t\t\tUserMatchLexer lexer = new UserMatchLexer(is);\n\t\t\tlexer.removeErrorListeners();\n\t\t\tlexer.addErrorListener(new BaseErrorListener() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line,\n\t\t\t\t\t\tint charPositionInLine, String msg, RecognitionException e) {\n\t\t\t\t\tthrow new RuntimeException(\"Malformed user match\");\n\t\t\t\t}","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/util/usermatch/UserMatch.java#L64-L100","documentation":"If a criterion context in UserMatch.getUserMatchCriteria is neither a user nor a group criterion (and no recognized alternative), an ExplicitException 'Unrecognized user match criteria' is thrown. It means the parsed token does not map to any supported criteria type in the match grammar.","triggerScenarios":"Parsing a match expression using an unsupported criteria keyword or malformed clause, e.g. 'email:x@y.z' when only user/group criteria are supported.","commonSituations":"Guessing criteria syntax not in the grammar; copying match expressions from other systems; grammar version changes removing a criteria type.","solutions":["Use only supported criteria forms ('user:<name>' or 'group:<name>')","Check the UserMatch grammar/lexer for the exact supported tokens","Wrap parse in try-catch on ExplicitException to validate stored expressions"],"exampleFix":"// before\nuserMatchString = \"email:admin@example.com\";\n// after\nuserMatchString = \"user:admin\";","handlingStrategy":"validation","validationCode":"if (!(token.startsWith(\"user:\") || token.startsWith(\"group:\")))\n    throw new ExplicitException(\"Unsupported match criteria: \" + token);","typeGuard":null,"tryCatchPattern":"try {\n    UserMatch.parse(matchString);\n} catch (ExplicitException e) {\n    ui.showError(e.getMessage());\n}","preventionTips":["Use only documented criteria keywords (user:, group:)","Consult the UserMatch grammar before inventing criteria","Validate expressions in a try-catch before persistence"],"tags":["user-match","unsupported-criteria","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}