{"record":{"id":"93cb1bc1977c36cd","repo":"theonedev/onedev","slug":"unable-to-find-user-with-login-username","errorCode":null,"errorMessage":"Unable to find user with login: ${userName}","messagePattern":"Unable to find user with login: (.+?)","errorType":"validation","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/util/usermatch/UserMatch.java","lineNumber":73,"sourceCode":"\t\t\t\treturn false;\n\t\t}\n\t\tfor (UserMatchCriteria criteria: criterias) {\n\t\t\tif (criteria.matches(user))\n\t\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\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); ","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/util/usermatch/UserMatch.java#L55-L91","documentation":"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.","triggerScenarios":"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.","commonSituations":"User renamed or removed after the match string was saved; config copied between instances; typo or wrong-case login.","solutions":["Fix the user login in the match string to an existing user","Replace the user clause with a group clause that still exists","Validate via UserMatch.parse in a try-catch before persisting the configuration"],"exampleFix":"// before\nuserMatchString = \"user:alice2\";\n// after\nuserMatchString = \"user:alice\";","handlingStrategy":"validation","validationCode":"User user = OneDev.getInstance(UserService.class).findByName(login);\nif (user == null)\n    throw new ExplicitException(\"Unknown user in match: \" + login);","typeGuard":null,"tryCatchPattern":"try {\n    UserMatch.parse(matchString);\n} catch (ExplicitException e) {\n    ui.showError(e.getMessage());\n}","preventionTips":["Use a user picker instead of free-text logins","Re-validate match strings after user rename/delete","Prefer group criteria for stability"],"tags":["user-match","user-not-found","validation"],"backgroundTag":"user-not-found","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"}