{"record":{"id":"4ac2f5bfb7609378","repo":"theonedev/onedev","slug":"unable-to-find-build-project-s-build-number-4ac2f5","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-markdown/src/main/java/io/onedev/server/plugin/report/markdown/MarkdownReportDownloadResource.java","lineNumber":53,"sourceCode":"\t\n\t@Override\n\tprotected ResourceResponse newResourceResponse(Attributes attributes) {\n\t\tPageParameters params = attributes.getParameters();\n\n\t\tString projectPath = params.get(PARAM_PROJECT).toString();\n\t\tProject project = OneDev.getInstance(ProjectService.class).findByPath(projectPath);\n\t\t\n\t\tLong buildNumber = params.get(PARAM_BUILD).toOptionalLong();\n\t\t\n\t\tif (buildNumber == null)\n\t\t\tthrow new IllegalArgumentException(\"build number has to be specified\");\n\t\t\n\t\tBuild build = OneDev.getInstance(BuildService.class).find(project, buildNumber);\n\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).toOptionalString();\n\t\t\n\t\tif (reportName == null)\n\t\t\tthrow new IllegalArgumentException(\"Markdown report name has to be specified\");\n\t\tif (reportName.contains(\"..\"))\n\t\t\tthrow new ExplicitException(\"Invalid request path\");\n\t\t\n\t\tif (!SecurityUtils.canAccessReport(build, reportName))\n\t\t\tthrow new UnauthorizedException();\n\t\t\t\n\t\tList<String> pathSegments = new ArrayList<>();\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)","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-report-markdown/src/main/java/io/onedev/server/plugin/report/markdown/MarkdownReportDownloadResource.java#L35-L71","documentation":"MarkdownReportDownloadResource looks up the build via BuildService.find(project, buildNumber); if absent it throws EntityNotFoundException with a formatted 'Unable to find build (project: %s, build number: %d)' message. Same semantics as the HTML report resource: the requested build does not exist for the given project.","triggerScenarios":"GET with valid build-number format but a number that has no matching build in the project (deleted build, wrong project path, typo).","commonSituations":"Retention/pruning removed the build; cross-project links with mismatched project path; URL copied from another environment.","solutions":["Verify project path and build number in the request","Check the build was not deleted by retention rules; use an existing build","Regenerate the report link from a live build"],"exampleFix":"// before\nGET /~resources/markdown-report/proj/9999/report/notes  // build 9999 deleted\n// after\nGET /~resources/markdown-report/proj/1043/report/notes","handlingStrategy":"validation","validationCode":"Build build = OneDev.getInstance(BuildService.class).find(project, buildNumber);\nif (build == null) throw new IllegalArgumentException(\"Build not found: \" + projectPath + \"#\" + buildNumber);","typeGuard":"function buildExists(project, buildNumber) {\n  return OneDev.getInstance(BuildService.class).find(project, buildNumber) != null;\n}","tryCatchPattern":"try { fetch(url); } catch (EntityNotFoundException e) { // look up latest build and rebuild URL }","preventionTips":["Resolve build numbers at link-generation time","Verify the project path matches the target build","Consider retention policies when referencing old builds"],"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"}