{"record":{"id":"4135c6c2206294a8","repo":"theonedev/onedev","slug":"pull-request-default-assignee-not-found-usernam","errorCode":null,"errorMessage":"Pull request default assignee not found: ${userName}","messagePattern":"Pull request default assignee not found: (.+?)","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/model/Project.java","lineNumber":2118,"sourceCode":"\t\tProject current = this;\n\t\tdo {\n\t\t\tif (current.getPullRequestSetting().getDeleteSourceBranchAfterMerge() != null)\n\t\t\t\treturn current.getPullRequestSetting().getDeleteSourceBranchAfterMerge();\n\t\t\tcurrent = current.getParent();\n\t\t} while (current != null);\n\n\t\treturn false;\n\t}\n\t\n\tpublic List<User> findDefaultPullRequestAssignees() {\n\t\tProject current = this;\n\t\tdo {\n\t\t\tif (!current.getPullRequestSetting().getDefaultAssignees().isEmpty()) {\n\t\t\t\tvar users = new ArrayList<User>();\n\t\t\t\tfor (var userName: current.getPullRequestSetting().getDefaultAssignees()) {\n\t\t\t\t\tvar user = getUserService().findByName(userName);\n\t\t\t\t\tif (user == null)\n\t\t\t\t\t\tthrow new ExplicitException(\"Pull request default assignee not found: \" + userName);\n\t\t\t\t\telse if (!SecurityUtils.canWriteCode(user.asSubject(), this))\n\t\t\t\t\t\tthrow new ExplicitException(\"Pull request default assignee does not have code write permission over the target project: \" + userName);\n\t\t\t\t\tusers.add(user);\n\t\t\t\t}\n\t\t\t\treturn users;\n\t\t\t}\n\t\t\tcurrent = current.getParent();\n\t\t} while (current != null);\n\n\t\treturn new ArrayList<>();\n\t}\n\t\n\tpublic String getSiteLockName() {\n\t\treturn getSiteLockName(getId());\n\t}\n\t\n\tpublic static String getSiteLockName(Long projectId) {\n\t\treturn \"project-site:\" + projectId;","sourceCodeStart":2100,"sourceCodeEnd":2136,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/model/Project.java#L2100-L2136","documentation":"When OneDev determines default assignees for a pull request, it walks the project hierarchy and resolves each configured default assignee by name via UserService.findByName(). This ExplicitException is thrown when a name listed in the project's pull request settings does not match any existing user. It is a configuration error, not a runtime failure.","triggerScenarios":"Project's PullRequestSetting.defaultAssignees contains a username that no longer exists (user deleted or renamed) while opening a pull request into that project (or a child inheriting the setting).","commonSituations":"User account deleted after being configured as default assignee; username typo in project settings; LDAP/user directory sync renamed accounts; inheriting settings from parent project with stale names.","solutions":["Open project (or parent project) settings → Pull Request settings and remove or correct the stale default assignee name","Check whether the user was renamed and update the setting to the current name","Recreate the user account if it was deleted and is still needed","Audit parent projects in the hierarchy, since the setting is resolved upward through parents"],"exampleFix":"// before (project setting)\ndefaultAssignees: [\"jdoe\"]   // jdoe deleted\n// after\ndefaultAssignees: [\"john.doe\"]  // existing active user with code write permission","handlingStrategy":"validation","validationCode":"for (String name : project.getPullRequestSetting().getDefaultAssignees()) {\n    if (OneDev.getInstance(UserService.class).findByName(name) == null)\n        throw new ValidationException(\"Default assignee not found: \" + name);\n}","typeGuard":null,"tryCatchPattern":"try {\n    users = project.getPullRequestSetting().getDefaultAssigneeUsers();\n} catch (ExplicitException e) {\n    logger.warn(\"Bad default assignee config: {}\", e.getMessage());\n}","preventionTips":["Validate default assignees when saving project settings","Clean up settings when deleting user accounts","Prefer group-based assignment or review rules over raw usernames"],"tags":["pull-request","configuration","user"],"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"}