theonedev/onedev · error · ExplicitException

Pull request default assignee not found: ${userName}

Error message

Pull request default assignee not found: ${userName}

What it means

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.

Source

Thrown at server-core/src/main/java/io/onedev/server/model/Project.java:2118

		Project current = this;
		do {
			if (current.getPullRequestSetting().getDeleteSourceBranchAfterMerge() != null)
				return current.getPullRequestSetting().getDeleteSourceBranchAfterMerge();
			current = current.getParent();
		} while (current != null);

		return false;
	}
	
	public List<User> findDefaultPullRequestAssignees() {
		Project current = this;
		do {
			if (!current.getPullRequestSetting().getDefaultAssignees().isEmpty()) {
				var users = new ArrayList<User>();
				for (var userName: current.getPullRequestSetting().getDefaultAssignees()) {
					var user = getUserService().findByName(userName);
					if (user == null)
						throw new ExplicitException("Pull request default assignee not found: " + userName);
					else if (!SecurityUtils.canWriteCode(user.asSubject(), this))
						throw new ExplicitException("Pull request default assignee does not have code write permission over the target project: " + userName);
					users.add(user);
				}
				return users;
			}
			current = current.getParent();
		} while (current != null);

		return new ArrayList<>();
	}
	
	public String getSiteLockName() {
		return getSiteLockName(getId());
	}
	
	public static String getSiteLockName(Long projectId) {
		return "project-site:" + projectId;

View on GitHub (pinned to d44925c47c)

Solutions

  1. Open project (or parent project) settings → Pull Request settings and remove or correct the stale default assignee name
  2. Check whether the user was renamed and update the setting to the current name
  3. Recreate the user account if it was deleted and is still needed
  4. Audit parent projects in the hierarchy, since the setting is resolved upward through parents

Example fix

// before (project setting)
defaultAssignees: ["jdoe"]   // jdoe deleted
// after
defaultAssignees: ["john.doe"]  // existing active user with code write permission
Defensive patterns

Strategy: validation

Validate before calling

for (String name : project.getPullRequestSetting().getDefaultAssignees()) {
    if (OneDev.getInstance(UserService.class).findByName(name) == null)
        throw new ValidationException("Default assignee not found: " + name);
}

Try / catch

try {
    users = project.getPullRequestSetting().getDefaultAssigneeUsers();
} catch (ExplicitException e) {
    logger.warn("Bad default assignee config: {}", e.getMessage());
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

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/4135c6c2206294a8. Report an issue: GitHub.