theonedev/onedev · error · EntityNotFoundException
Unable to find build (project: %s, build number: %d)
Error message
Unable to find build (project: %s, build number: %d)
What it means
HtmlReportDownloadResource.newResourceResponse() looks up the build via BuildService.find(project, buildNumber) and throws EntityNotFoundException when no build matches. This REST/Wicket resource serves HTML report files, and the error tells the client the referenced build does not exist in the project.
Source
Thrown at server-plugin/server-plugin-report-html/src/main/java/io/onedev/server/plugin/report/html/HtmlReportDownloadResource.java:48
private static final String PARAM_PROJECT = "project";
private static final String PARAM_BUILD = "build";
private static final String PARAM_REPORT = "report";
@Override
protected ResourceResponse newResourceResponse(Attributes attributes) {
var params = attributes.getParameters();
var projectId = params.get(PARAM_PROJECT).toLong();
var project = OneDev.getInstance(ProjectService.class).load(projectId);
var buildNumber = params.get(PARAM_BUILD).toLong();
var build = OneDev.getInstance(BuildService.class).find(project, buildNumber);
if (build == null) {
String message = String.format("Unable to find build (project: %s, build number: %d)",
project.getPath(), buildNumber);
throw new EntityNotFoundException(message);
}
String reportName = params.get(PARAM_REPORT).toString();
if (reportName.contains(".."))
throw new ExplicitException("Invalid request path");
if (!SecurityUtils.canAccessReport(build, reportName))
throw new UnauthorizedException();
List<String> pathSegments = new ArrayList<>();
for (int i = 0; i < params.getIndexedCount(); i++) {
String pathSegment = params.get(i).toString();
if (pathSegment.contains(".."))
throw new ExplicitException("Invalid request path");
if (pathSegment.length() != 0)
pathSegments.add(pathSegment);
}View on GitHub (pinned to d44925c47c)
Solutions
- Verify the project path and build number in the request URL are correct
- Check the build still exists (it may have been deleted by retention policies)
- Regenerate any links/badges pointing at the report from a valid build
Example fix
// before GET /~resources/html-report/project-a/9999/report/index.html // build 9999 gone // after GET /~resources/html-report/project-a/1024/report/index.html
Defensive patterns
Strategy: validation
Validate before calling
Build build = OneDev.getInstance(BuildService.class).find(project, buildNumber);
if (build == null) throw new IllegalArgumentException("Build not found: " + project.getPath() + "#" + buildNumber); Type guard
function buildExists(project, buildNumber) {
return OneDev.getInstance(BuildService.class).find(project, buildNumber) != null;
} Try / catch
try { downloadReport(url); } catch (EntityNotFoundException e) { // resolve build number before retry } Prevention
- Resolve build numbers dynamically from the pipeline context, never hardcode
- Account for build retention policies in long-lived links
- Double-check project path when copying report URLs
When it happens
Trigger: GET on the html-report download resource with PARAM_PROJECT/PARAM_BUILD parameters where the build number does not exist for that project (build deleted, wrong number, wrong project path).
Common situations: Stale links after builds were pruned/cleaned; typo'd build number in an embedded badge/link; referencing a build in a different project than the one in the URL.
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 (project: %s, build number: %d)
- User not found: ${userName}
- Issue not found: ${referenceString}
- Not found
- Build not found: ${referenceString}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/0e0af7370a8899bb.
Report an issue: GitHub.