{"record":{"id":"8d6d825fa8320635","repo":"theonedev/onedev","slug":"unable-to-find-build-0-in-project-1-8d6d82","errorCode":null,"errorMessage":"Unable to find build #{0} in project {1}","messagePattern":"Unable to find build #(.+?) in project (.+?)","errorType":"exception","errorClass":"EntityNotFoundException","httpStatus":404,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/web/page/project/builds/detail/InvalidBuildPage.java","lineNumber":50,"sourceCode":"import io.onedev.server.web.util.ConfirmClickModifier;\n\npublic class InvalidBuildPage extends ProjectPage {\n\n\tpublic static final String PARAM_BUILD = \"build\";\n\t\n\tprivate IModel<Build> buildModel;\n\t\n\tpublic InvalidBuildPage(PageParameters params) {\n\t\tsuper(params);\n\t\t\n\t\tbuildModel = new LoadableDetachableModel<Build>() {\n\n\t\t\t@Override\n\t\t\tprotected Build load() {\n\t\t\t\tLong buildNumber = params.get(PARAM_BUILD).toLong();\n\t\t\t\tBuild build = OneDev.getInstance(BuildService.class).find(getProject(), buildNumber);\n\t\t\t\tif (build == null)\n\t\t\t\t\tthrow new EntityNotFoundException(MessageFormat.format(_T(\"Unable to find build #{0} in project {1}\"), String.valueOf(buildNumber), getProject()));\n\t\t\t\tPreconditions.checkState(!build.isValid());\n\t\t\t\treturn build;\n\t\t\t}\n\n\t\t};\n\t}\n\n\t@Override\n\tprotected void onInitialize() {\n\t\tsuper.onInitialize();\n\t\t\n\t\tvar build = getBuild();\n\t\tadd(new Label(\"missingCommit\", build.getCommitHash()));\n\t\tadd(new Label(\"jobName\", build.getJobName()));\n\t\t\n\t\tadd(new Link<Void>(\"delete\") {\n\n\t\t\t@Override","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/page/project/builds/detail/InvalidBuildPage.java#L32-L68","documentation":"InvalidBuildPage is the page shown for builds that exist but are invalid (e.g. build data was purged or marked invalid). Its LoadableDetachableModel first resolves the build by number; if BuildService.find returns null it throws EntityNotFoundException with 'Unable to find build #{0} in project {1}'. Same semantics as BuildDetailPage but on the invalid-build view.","triggerScenarios":"Visiting the invalid-build URL (~builds/<n>/invalid or equivalent) where the build number does not resolve to any build in the project.","commonSituations":"Bookmarked link to a build later deleted/cleaned up; cluster database restored without old builds; referencing a build number that belongs to a different project.","solutions":["Confirm the build number exists under the correct project and fix the URL.","If the build was removed by cleanup rules, adjust project build cleanup settings and re-run the pipeline.","Restore the build record from a database backup if history must be retained."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"Build b = OneDev.getInstance(BuildService.class).find(project, buildNumber);\nif (b == null) { /* abort: build does not exist; do not open invalid-build view */ }","typeGuard":null,"tryCatchPattern":"try { ... } catch (EntityNotFoundException e) { redirect to project build list }","preventionTips":["Keep build retention/cleanup rules aligned with any external references to build URLs.","Verify project and build number against the database/API before linking."],"tags":["onedev","build","entity-not-found"],"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-14T05:17:10.506Z"}