theonedev/onedev · error · NotFoundException

Assignee not found:

Error message

Assignee not found: 

What it means

The TOD endpoint resolves each name in the 'assignees' array via userService.findByName() and throws a JAX-RS NotFoundException (HTTP 404) when a name matches no user. The request aborts before creating PullRequestAssignment records.

Source

Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:1188

                if (reviewer.equals(request.getSubmitter()))
                    throw new NotAcceptableException("Pull request submitter cannot be reviewer");

                if (request.getReview(reviewer) == null) {
                    PullRequestReview review = new PullRequestReview();
                    review.setRequest(request);
                    review.setUser(reviewer);
                    request.getReviews().add(review);
                }
            }
        }

        @SuppressWarnings("unchecked")
        var assigneeNames = (List<String>) data.remove("assignees");
        if (assigneeNames != null) {
            for (var assigneeName : assigneeNames) {
                User assignee = userService.findByName(assigneeName);
                if (assignee == null)
                    throw new NotFoundException("Assignee not found: " + assigneeName);
                PullRequestAssignment assignment = new PullRequestAssignment();
                assignment.setRequest(request);
                assignment.setUser(assignee);
                request.getAssignments().add(assignment);
            }
        }

        pullRequestService.open(request);

        return PullRequestHelper.getDetail(currentProject, request);        
    }

    @Api(description = "Get pull request title and description requirement")
    @Path("/get-pull-request-title-and-description-requirement")
    @GET
    @Nullable
    public String getPullRequestTitleAndDescriptionRequirement(
                @QueryParam("currentProject") @NotNull String currentProjectPath, 

View on GitHub (pinned to d44925c47c)

Solutions

  1. Check the 'assignees' list against the OneDev user list and correct invalid names.
  2. Remove non-existent assignees and resubmit.
  3. Validate names via user lookup API before calling the endpoint.

Example fix

// before
data.put("assignees", List.of("john.doe@example.com"));
// after
data.put("assignees", List.of("jdoe"));
Defensive patterns

Strategy: validation

Validate before calling

for (var name : (List<String>) data.getOrDefault("assignees", List.of())) {
    if (userService.findByName(name) == null)
        throw new IllegalArgumentException("Unknown assignee: " + name);
}

Try / catch

try {
    callEditEndpoint(data);
} catch (NotFoundException e) {
    if (e.getMessage().startsWith("Assignee not found")) {
        // drop the invalid assignee and retry
    } else throw e;
}

Prevention

When it happens

Trigger: POST to the TodResource pull-request edit endpoint with data containing an 'assignees' list where any entry is not an exact existing username.

Common situations: Typo in assignee name; using display name or email instead of login name; assignee account deleted or renamed; AI agent inventing 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/ee092250fbe1626d. Report an issue: GitHub.