{"record":{"id":"0e0af7370a8899bb","repo":"theonedev/onedev","slug":"unable-to-find-build-project-s-build-number-0e0af7","errorCode":null,"errorMessage":"Unable to find build (project: %s, build number: %d)","messagePattern":"Unable to find build \\(project: (.+?), build number: (.+?)\\)","errorType":"http","errorClass":"EntityNotFoundException","httpStatus":404,"severity":"error","filePath":"server-plugin/server-plugin-report-html/src/main/java/io/onedev/server/plugin/report/html/HtmlReportDownloadResource.java","lineNumber":48,"sourceCode":"\tprivate static final String PARAM_PROJECT = \"project\";\n\t\n\tprivate static final String PARAM_BUILD = \"build\";\n\n\tprivate static final String PARAM_REPORT = \"report\";\n\t\n\t@Override\n\tprotected ResourceResponse newResourceResponse(Attributes attributes) {\n\t\tvar params = attributes.getParameters();\n\n\t\tvar projectId = params.get(PARAM_PROJECT).toLong();\n\t\tvar project = OneDev.getInstance(ProjectService.class).load(projectId);\n\t\t\n\t\tvar buildNumber = params.get(PARAM_BUILD).toLong();\n\t\tvar build = OneDev.getInstance(BuildService.class).find(project, buildNumber);\n\t\tif (build == null) {\n\t\t\tString message = String.format(\"Unable to find build (project: %s, build number: %d)\",\n\t\t\t\t\tproject.getPath(), buildNumber);\n\t\t\tthrow new EntityNotFoundException(message);\n\t\t}\n\t\t\n\t\tString reportName = params.get(PARAM_REPORT).toString();\n\t\tif (reportName.contains(\"..\"))\n\t\t\tthrow new ExplicitException(\"Invalid request path\");\n\n\t\tif (!SecurityUtils.canAccessReport(build, reportName))\n\t\t\tthrow new UnauthorizedException();\n\n\t\tList<String> pathSegments = new ArrayList<>();\n\n\t\tfor (int i = 0; i < params.getIndexedCount(); i++) {\n\t\t\tString pathSegment = params.get(i).toString();\n\t\t\tif (pathSegment.contains(\"..\"))\n\t\t\t\tthrow new ExplicitException(\"Invalid request path\");\n\t\t\tif (pathSegment.length() != 0)\n\t\t\t\tpathSegments.add(pathSegment);\n\t\t}","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-report-html/src/main/java/io/onedev/server/plugin/report/html/HtmlReportDownloadResource.java#L30-L66","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nGET /~resources/html-report/project-a/9999/report/index.html  // build 9999 gone\n// after\nGET /~resources/html-report/project-a/1024/report/index.html","handlingStrategy":"validation","validationCode":"Build build = OneDev.getInstance(BuildService.class).find(project, buildNumber);\nif (build == null) throw new IllegalArgumentException(\"Build not found: \" + project.getPath() + \"#\" + buildNumber);","typeGuard":"function buildExists(project, buildNumber) {\n  return OneDev.getInstance(BuildService.class).find(project, buildNumber) != null;\n}","tryCatchPattern":"try { downloadReport(url); } catch (EntityNotFoundException e) { // resolve build number before retry }","preventionTips":["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"],"tags":["rest","build","not-found","report"],"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"}