{"record":{"id":"0ca188df1d227286","repo":"theonedev/onedev","slug":"unable-to-find-pull-request-0-in-project-1","errorCode":null,"errorMessage":"Unable to find pull request #{0} in project {1}","messagePattern":"Unable to find pull request #(.+?) in project (.+?)","errorType":"exception","errorClass":"EntityNotFoundException","httpStatus":404,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/PullRequestDetailPage.java","lineNumber":258,"sourceCode":"\t\tif (StringUtils.isBlank(requestNumberString)) {\n\t\t\tthrow new RestartResponseException(ProjectPullRequestsPage.class,\n\t\t\t\t\tProjectPullRequestsPage.paramsOf(getProject(), null, 0));\n\t\t}\n\n\t\trequestModel = new LoadableDetachableModel<>() {\n\n\t\t\t@Override\n\t\t\tprotected PullRequest load() {\n\t\t\t\tLong requestNumber;\n\t\t\t\ttry {\n\t\t\t\t\trequestNumber = Long.valueOf(requestNumberString);\n\t\t\t\t} catch (NumberFormatException e) {\n\t\t\t\t\tthrow new NotAcceptableException(MessageFormat.format(_T(\"Invalid pull request number: {0}\"), requestNumberString));\n\t\t\t\t}\n\n\t\t\t\tPullRequest request = pullRequestService.find(getProject(), requestNumber);\n\t\t\t\tif (request == null) {\n\t\t\t\t\tthrow new EntityNotFoundException(MessageFormat.format(_T(\"Unable to find pull request #{0} in project {1}\"), requestNumber, getProject().getPath()));\n\t\t\t\t} else if (!request.getTargetProject().equals(getProject())) {\n\t\t\t\t\tthrow new RestartResponseException(getPageClass(), paramsOf(request));\n\t\t\t\t} else {\n\t\t\t\t\treturn request;\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t\tif (!getPullRequest().isValid()) {\n\t\t\tthrow new RestartResponseException(InvalidPullRequestPage.class,\n\t\t\t\t\tInvalidPullRequestPage.paramsOf(getPullRequest()));\n\t\t}\n\n\t\tlatestUpdateId = requestModel.getObject().getLatestUpdate().getId();\n\t}\n\n\tprivate WebMarkupContainer newRequestHead() {","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/PullRequestDetailPage.java#L240-L276","documentation":"PullRequestDetailPage looks up the pull request by number in the current project; when pullRequestService.find returns null it throws EntityNotFoundException with this message. The number was valid but no matching pull request exists in that project.","triggerScenarios":"Accessing a PR detail URL whose number does not exist in the project (deleted PR, wrong project, number beyond existing range).","commonSituations":"Following links from notifications after the PR was deleted; confusing a fork's PR numbers with the target project's numbers; database restored from an older backup while links were newer.","solutions":["Confirm the PR number exists in this project's pull requests list.","Check the URL's project path — the PR may belong to a different (e.g. fork) project.","Use the pull request list or search to obtain the correct link."],"exampleFix":"// before\nopen(\"/projects/\" + wrongProject + \"/~pulls/\" + number);\n// after\nopen(\"/projects/\" + request.getTargetProject().getPath() + \"/~pulls/\" + request.getNumber());","handlingStrategy":"validation","validationCode":"PullRequest request = pullRequestService.find(project, number);\nif (request == null) throw new IllegalArgumentException(\"PR #\" + number + \" not found in \" + project.getPath());","typeGuard":"boolean prExistsInProject(Project p, long number) { return pullRequestService.find(p, number) != null; }","tryCatchPattern":"try { showPullRequest(number); } catch (EntityNotFoundException e) { renderPrMissing(number); }","preventionTips":["Verify PR existence in the exact project before linking.","Use request.getTargetProject() for the authoritative project of a PR.","Purge or redirect links to deleted pull requests."],"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"}