theonedev/onedev · error · EntityNotFoundException
Unable to find build #{0} in project {1}
Error message
Unable to find build #{0} in project {1} What it means
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.
Source
Thrown at server-core/src/main/java/io/onedev/server/web/page/project/builds/detail/InvalidBuildPage.java:50
import io.onedev.server.web.util.ConfirmClickModifier;
public class InvalidBuildPage extends ProjectPage {
public static final String PARAM_BUILD = "build";
private IModel<Build> buildModel;
public InvalidBuildPage(PageParameters params) {
super(params);
buildModel = new LoadableDetachableModel<Build>() {
@Override
protected Build load() {
Long buildNumber = params.get(PARAM_BUILD).toLong();
Build build = OneDev.getInstance(BuildService.class).find(getProject(), buildNumber);
if (build == null)
throw new EntityNotFoundException(MessageFormat.format(_T("Unable to find build #{0} in project {1}"), String.valueOf(buildNumber), getProject()));
Preconditions.checkState(!build.isValid());
return build;
}
};
}
@Override
protected void onInitialize() {
super.onInitialize();
var build = getBuild();
add(new Label("missingCommit", build.getCommitHash()));
add(new Label("jobName", build.getJobName()));
add(new Link<Void>("delete") {
@OverrideView on GitHub (pinned to d44925c47c)
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.
Defensive patterns
Strategy: validation
Validate before calling
Build b = OneDev.getInstance(BuildService.class).find(project, buildNumber);
if (b == null) { /* abort: build does not exist; do not open invalid-build view */ } Try / catch
try { ... } catch (EntityNotFoundException e) { redirect to project build list } Prevention
- Keep build retention/cleanup rules aligned with any external references to build URLs.
- Verify project and build number against the database/API before linking.
When it happens
Trigger: Visiting the invalid-build URL (~builds/<n>/invalid or equivalent) where the build number does not resolve to any build in the project.
Common situations: 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.
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 #{0} in project {1}
- Unable to find build:
- No current build in query context
- No build in query context
- No build in query context
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/8d6d825fa8320635.
Report an issue: GitHub.