{"record":{"id":"a6cd466f2d1a8396","repo":"theonedev/onedev","slug":"unable-to-find-build","errorCode":null,"errorMessage":"Unable to find build: ","messagePattern":"Unable to find build: ","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/search/commit/Revision.java","lineNumber":62,"sourceCode":"\tpublic Type getType() {\n\t\treturn type;\n\t}\n\n\t@Nullable\n\tpublic String getValue() {\n\t\treturn value;\n\t}\n\n\tpublic boolean isSince() {\n\t\treturn since;\n\t}\n\t\n\tpublic Build getValueAsBuild(Project project) {\n\t\tvar buildReference = BuildReference.of(value, project);\n\t\tvar buildService = OneDev.getInstance(BuildService.class);\n\t\tvar build = buildService.find(buildReference.getProject(), buildReference.getNumber());\n\t\tif (build == null)\n\t\t\tthrow new ExplicitException(\"Unable to find build: \" + value);\n\t\telse\n\t\t\treturn build;\n\t}\n\n\tpublic RevCommit getRevCommit(Project project) {\n\t\tif (type == Type.BRANCH) {\n\t\t\tString branch = value;\n\t\t\tif (branch == null) {\n\t\t\t\tbranch = project.getDefaultBranch();\n\t\t\t\tif (branch == null) \n\t\t\t\t\tthrow new ExplicitException(\"No default branch\");\n\t\t\t}\n\t\t\treturn project.getRevCommit(GitUtils.branch2ref(branch), true);\n\t\t} else if (type == Type.TAG) {\n\t\t\treturn project.getRevCommit(GitUtils.tag2ref(value), true);\n\t\t} else if (type == Type.COMMIT) {\n\t\t\treturn project.getRevCommit(value, true);\n\t\t} else if (type == Type.BUILD) {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/search/commit/Revision.java#L44-L80","documentation":"Revision.getValueAsBuild() resolves the revision value to a numbered build via BuildReference and BuildService; if no build with that number exists in the referenced project, an ExplicitException 'Unable to find build: <value>' is thrown.","triggerScenarios":"Using a revision string like '#123' (build reference) in a commit query or revision field when build #123 does not exist in the project (deleted build, wrong project, typo in number).","commonSituations":"Referring to a build number from another project; build was purged/retention-deleted; query copied between projects with different numbering.","solutions":["Verify the build number exists in the target project's build list","Check the query runs against the intended project","Replace the build reference with a branch/tag/commit hash","Enable retention to keep referenced builds from being deleted"],"exampleFix":"// before\nq = \"build is #999\" // build deleted\n// after\nq = \"branch is main\" // or pick an existing build number","handlingStrategy":"validation","validationCode":"Build build = OneDev.getInstance(BuildService.class).find(project, 123);\nif (build == null) throw new IllegalArgumentException(\"build #123 not found in \" + project.getName());","typeGuard":null,"tryCatchPattern":"try { rev.getValueAsBuild(project); } catch (ExplicitException e) { /* show 'build not found' to user */ }","preventionTips":["Validate build numbers exist before embedding them in queries","Be aware retention policies can delete referenced builds","Avoid copying build references across projects"],"tags":["build","not-found","onedev"],"backgroundTag":"record-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"}