theonedev/onedev · error · NotFoundException
Unable to find build: ${value}
Error message
Unable to find build: ${value} What it means
QueryUtils.getBuild resolves a build reference (e.g. '#100' or 'project#100') to a Build entity via BuildService.find. If no build with that number exists in the referenced project, a NotFoundException 'Unable to find build' is thrown.
Source
Thrown at server-core/src/main/java/io/onedev/server/util/QueryUtils.java:170
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);
}
}
public static Iteration getIteration(@Nullable Project project, String value) {
if (project != null && !value.contains(":"))
value = project.getPath() + ":" + value;
Iteration iteration = OneDev.getInstance(IterationService.class).findInHierarchy(value);
if (iteration != null)
return iteration;View on GitHub (pinned to d44925c47c)
Solutions
- Verify the build number exists in the specified project (check the build URL in OneDev)
- Add the project scope to the reference (e.g. 'group/project#100') or pass the correct default Project
- Confirm the number is a build number, not an issue or PR number
- Update saved queries when builds are purged or the project path changes
Example fix
// before Build build = QueryUtils.getBuild(null, "#100"); // after Build build = QueryUtils.getBuild(project, "group/my-project#100");
Defensive patterns
Strategy: try-catch
Validate before calling
if (!value.matches("(#\\d+|[^#]+#\\d+)"))
throw new UserException("Build reference must look like '#100' or 'project#100'"); Type guard
boolean isBuildReference(String s) {
return s != null && s.matches("(#\\d+|[^#]+#\\d+)");
} Try / catch
try {
Build build = QueryUtils.getBuild(project, value);
} catch (NotFoundException e) {
logger.warn("Build not found: {}", value);
} Prevention
- Scope build references with the project path
- Remember build numbers are per-project, so never reuse numbers across projects in queries
- Update queries after build purge policies remove old builds
When it happens
Trigger: Calling QueryUtils.getBuild with a build number that does not exist in the target project; missing project prefix when project is null; number belongs to a different project than the referenced one.
Common situations: Query criteria referencing build numbers from another project; build numbers that never ran in that project; projects where builds were purged; typos or confusing issue/PR numbers with build numbers.
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
- Unable to find build:
- Unable to find project '${projectPath}'
- Unable to find issue: ${value}
- Unable to find pull request: ${value}
- Unable to find iteration: ${value}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/bfa53db0a8ceab61.
Report an issue: GitHub.