theonedev/onedev · error · NotFoundException
Unable to find pull request: ${value}
Error message
Unable to find pull request: ${value} What it means
QueryUtils.getPullRequest resolves a pull request reference (e.g. '#12' or 'project#12') via PullRequestService.find. When no pull request with that number exists in the referenced project, a NotFoundException 'Unable to find pull request' is thrown.
Source
Thrown at server-core/src/main/java/io/onedev/server/util/QueryUtils.java:161
}
public static Issue getIssue(@Nullable Project project, String value) {
var reference = IssueReference.of(value, project);
var issueService = OneDev.getInstance(IssueService.class);
var issue = issueService.find(reference.getProject(), reference.getNumber());
if (issue != null)
return issue.resolveMovedTo();
else
throw new NotFoundException("Unable to find issue: " + value);
}
public static PullRequest getPullRequest(@Nullable Project project, String value) {
var reference = PullRequestReference.of(value, project);
var pullRequest = OneDev.getInstance(PullRequestService.class).find(reference.getProject(), reference.getNumber());
if (pullRequest != null)
return pullRequest;
else
throw new NotFoundException("Unable to find pull request: " + value);
}
public static Build getBuild(@Nullable Project project, String value) {
var reference = BuildReference.of(value, project);
var build = OneDev.getInstance(BuildService.class).find(reference.getProject(), reference.getNumber());
if (build != null)
return build;
else
throw new NotFoundException("Unable to find build: " + value);
}
public static Long getNumber(String value) {
if (value.startsWith("#"))
value = value.substring(1);
try {
return Long.parseLong(value);
} catch (NumberFormatException e) {
throw new NotAcceptableException("Invalid number: " + value);View on GitHub (pinned to d44925c47c)
Solutions
- Verify the pull request number exists in the specified project via the OneDev UI
- Prefix the reference with the project path (e.g. 'group/project#12') or pass the correct default Project
- Confirm the number is a pull request, not an issue or build number
- Update saved queries if the PR was deleted or the project renamed
Example fix
// before PullRequest pr = QueryUtils.getPullRequest(null, "#12"); // after PullRequest pr = QueryUtils.getPullRequest(project, "group/my-project#12");
Defensive patterns
Strategy: try-catch
Validate before calling
if (!value.matches("(#\\d+|[^#]+#\\d+)"))
throw new UserException("Pull request reference must look like '#12' or 'project#12'"); Type guard
boolean isPullRequestReference(String s) {
return s != null && s.matches("(#\\d+|[^#]+#\\d+)");
} Try / catch
try {
PullRequest pr = QueryUtils.getPullRequest(project, value);
} catch (NotFoundException e) {
logger.warn("Pull request not found: {}", value);
} Prevention
- Scope PR references with the project path in cross-project contexts
- Confirm the number is a pull request number via the UI
- Refresh saved queries after PRs are deleted
When it happens
Trigger: Calling QueryUtils.getPullRequest with a PR number absent from the target project; missing project prefix when project is null; number refers to an issue or build rather than a pull request.
Common situations: Saved queries with PR numbers that were later deleted; confusing issue numbers with PR numbers (both use '#N'); PRs in projects the caller cannot access; typos in the number.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Pull request not found:
- Unable to find project '${projectPath}'
- Unable to find issue: ${value}
- Unable to find build: ${value}
- Unable to find iteration: ${value}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/206c6add7f4fde37.
Report an issue: GitHub.