{"record":{"id":"6b120cbc9ee3c597","repo":"theonedev/onedev","slug":"impossible-to-provide-required-number-of-reviewers","errorCode":null,"errorMessage":"Impossible to provide required number of reviewers (candidates: %s, required number of reviewers: %d, pull request: #%d)","messagePattern":"Impossible to provide required number of reviewers \\(candidates: (.+?), required number of reviewers: (.+?), pull request: #(.+?)\\)","errorType":"error_code","errorClass":"ExplicitException","httpStatus":400,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/service/impl/DefaultPullRequestService.java","lineNumber":983,"sourceCode":"\t\t\t\tpublic int compare(PullRequestReview o1, PullRequestReview o2) {\n\t\t\t\t\treturn o1.getStatusDate().compareTo(o2.getStatusDate());\n\t\t\t\t}\n\n\t\t\t});\n\t\t\tfor (PullRequestReview review: reviews) {\n\t\t\t\tif (users.contains(review.getUser()) && review.getStatus() == PullRequestReview.Status.EXCLUDED) {\n\t\t\t\t\treviewers.add(review.getUser());\n\t\t\t\t\treview.setStatus(PullRequestReview.Status.PENDING);\n\t\t\t\t\tif (reviewers.size() == requiredCount)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (requiredCount > reviewers.size()) {\n\t\t\tString errorMessage = String.format(\"Impossible to provide required number of reviewers \"\n\t\t\t\t\t+ \"(candidates: %s, required number of reviewers: %d, pull request: #%d)\",\n\t\t\t\t\treviewers, requiredCount, request.getNumber());\n\t\t\tthrow new ExplicitException(errorMessage);\n\t\t}\n\t}\n\n\tprivate Predicate[] getPredicates(Subject subject, Project targetProject, @Nullable Criteria<PullRequest> criteria,\n\t\t\tCriteriaQuery<?> query, From<PullRequest, PullRequest> from, CriteriaBuilder builder) {\n\t\tList<Predicate> predicates = new ArrayList<>();\n\t\tif (targetProject != null) {\n\t\t\tpredicates.add(builder.equal(from.get(PullRequest.PROP_TARGET_PROJECT), targetProject));\n\t\t} else if (!SecurityUtils.isAdministrator(subject)) {\n\t\t\tCollection<Project> projects = SecurityUtils.getAuthorizedProjects(subject, new ReadCode());\n\t\t\tif (!projects.isEmpty()) {\n\t\t\t\tPath<Long> projectIdPath = from.get(PullRequest.PROP_TARGET_PROJECT).get(Project.PROP_ID);\n\t\t\t\tpredicates.add(Criteria.forManyValues(builder, projectIdPath,\n\t\t\t\t\t\tprojects.stream().map(it->it.getId()).collect(Collectors.toSet()),\n\t\t\t\t\t\tprojectService.getIds()));\n\t\t\t} else {\n\t\t\t\tpredicates.add(builder.disjunction());\n\t\t\t}","sourceCodeStart":965,"sourceCodeEnd":1001,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/service/impl/DefaultPullRequestService.java#L965-L1001","documentation":"During PR creation, OneDev tries to auto-assign the required number of reviewers from the candidate set. If requiredCount exceeds the number of available reviewers it cannot satisfy the review requirement and throws an ExplicitException naming the candidates, required count, and PR number.","triggerScenarios":"Opening a pull request whose branch protection / review requirement demands N reviewers, but the eligible reviewer candidate list (after project roles, author exclusion, availability filters) contains fewer than N people.","commonSituations":"Small teams or personal projects where required-reviewers > team size; review job configured with required count 2 but only one eligible user on the project; candidates filtered out because they are the PR author or lack read permission.","solutions":["Lower the required number of reviewers in the project's pull request review settings to <= number of eligible candidates","Add more users with appropriate permissions/roles to the project so they qualify as candidates","Check candidate filters (the PR author is excluded; eligibility rules in the review requirement) and adjust","Use a group/specification for candidates that actually matches existing project members"],"exampleFix":"// before (project config)\n\"requiredReviewers\": 3,   // only 1 eligible user on project\n// after\n\"requiredReviewers\": 1,   // or add more eligible project members","handlingStrategy":"try-catch","validationCode":"int eligible = countEligibleReviewers(project, pullRequestAuthor);\nint required = reviewRequirement.getRequiredReviewers();\nif (required > eligible)\n    throw new ConfigurationException(\"Lower required reviewers or add eligible members (have \" + eligible + \")\");","typeGuard":null,"tryCatchPattern":"try {\n    pullRequestService.open(request);\n} catch (ExplicitException e) {\n    if (e.getMessage().startsWith(\"Impossible to provide required number of reviewers\"))\n        notifyAdminToFixReviewConfig(e.getMessage());\n    else throw e;\n}","preventionTips":["Keep required-reviewer count <= number of project members eligible to review","Remember the PR author is excluded from candidates","Audit review requirement settings after team changes"],"tags":["pull-request","code-review","configuration","reviewers","onedev"],"backgroundTag":"invalid-config-value","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}