{"record":{"id":"bc625016afc1a7b8","repo":"theonedev/onedev","slug":"unable-to-find-pull-request-n-in-project-proje","errorCode":null,"errorMessage":"Unable to find pull request #<n> in project <project>","messagePattern":"Unable to find pull request #<n> in project <project>","errorType":"exception","errorClass":"EntityNotFoundException","httpStatus":404,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/InvalidPullRequestPage.java","lineNumber":58,"sourceCode":"import io.onedev.server.web.util.ConfirmClickModifier;\n\npublic class InvalidPullRequestPage extends ProjectPage {\n\n\tpublic static final String PARAM_REQUEST = \"request\";\n\t\n\tprivate IModel<PullRequest> requestModel;\n\t\n\tpublic InvalidPullRequestPage(PageParameters params) {\n\t\tsuper(params);\n\t\t\n\t\trequestModel = new LoadableDetachableModel<PullRequest>() {\n\n\t\t\t@Override\n\t\t\tprotected PullRequest load() {\n\t\t\t\tLong requestNumber = params.get(PARAM_REQUEST).toLong();\n\t\t\t\tPullRequest request = OneDev.getInstance(PullRequestService.class).find(getProject(), requestNumber);\n\t\t\t\tif (request == null)\n\t\t\t\t\tthrow new EntityNotFoundException(\"Unable to find pull request #\" + requestNumber + \" in project \" + getProject());\n\t\t\t\tPreconditions.checkState(!request.isValid());\n\t\t\t\treturn request;\n\t\t\t}\n\n\t\t};\n\t}\n\n\t@Override\n\tprotected void onInitialize() {\n\t\tsuper.onInitialize();\n\t\t\n\t\tvar request = getPullRequest();\n\t\tadd(new Label(\"missingCommits\", StringUtils.join(request.getMissingCommits().stream().map(ObjectId::getName).collect(toList()), \" \")));\n\t\tadd(new Label(\"requestBranches\", escapeHtml5(request.getTargetBranch()) + \" &larr; \" + escapeHtml5(request.getSourceBranch())).setEscapeModelStrings(false));\n\t\tif (request.getDescription() != null) {\n\t\t\tadd(new Label(\"requestTitle\", request.getTitle()).add(AttributeAppender.append(\"class\", \"mb-4\")));\n\t\t\tadd(new MarkdownViewer(\"requestDescription\", Model.of(request.getDescription()), null));\n\t\t} else {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/InvalidPullRequestPage.java#L40-L76","documentation":"InvalidPullRequestPage loads the pull request by number and throws EntityNotFoundException when PullRequestService.find returns null, i.e. no such request number exists in the project. This page exists specifically to report invalid/deleted pull requests, so the error means the referenced PR is entirely absent.","triggerScenarios":"Loading an invalid-PR URL whose PARAM_REQUEST number does not match any pull request in the current project; requesting a PR number that was never created or was removed.","commonSituations":"Deleted pull request still referenced by an old link or notification; PR created in a fork but looked up in the target project; typo in the PR number in a manually constructed URL.","solutions":["Verify the PR number exists in this project's pull request list.","Check that the URL points at the correct project (fork vs target project).","Open the PR from the pull request list instead of a stale link."],"exampleFix":"// before\nopen(\"/~/pull_requests/\" + number + \"/invalid\");\n// after\nPullRequest pr = pullRequestService.find(project, number);\nif (pr == null) throw new IllegalArgumentException(\"PR #\" + number + \" not found in \" + project.getPath());","handlingStrategy":"validation","validationCode":"PullRequest request = pullRequestService.find(project, requestNumber);\nif (request == null) throw new IllegalArgumentException(\"PR #\" + requestNumber + \" not found in \" + project.getPath());","typeGuard":"boolean pullRequestExists(Project p, long number) { return OneDev.getInstance(PullRequestService.class).find(p, number) != null; }","tryCatchPattern":"try { loadPullRequest(number); } catch (EntityNotFoundException e) { redirectToList(project); }","preventionTips":["Resolve PR links from the PR object, not stored raw numbers.","Account for forks: PR numbers belong to the project that owns the PR.","Handle deleted PRs gracefully in notifications/link processors."],"tags":["wicket","pull-requests","not-found","url"],"backgroundTag":"entity-not-found","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"}