theonedev/onedev · error · ExplicitException

Unable to find build:

Error message

Unable to find build: 

What it means

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.

Solutions

  1. Verify the build number exists in the target project's build list
  2. Check the query runs against the intended project
  3. Replace the build reference with a branch/tag/commit hash
  4. Enable retention to keep referenced builds from being deleted

Example fix

// before
q = "build is #999" // build deleted
// after
q = "branch is main" // or pick an existing build number
Defensive patterns

Strategy: validation

Validate before calling

Build build = OneDev.getInstance(BuildService.class).find(project, 123);
if (build == null) throw new IllegalArgumentException("build #123 not found in " + project.getName());

Try / catch

try { rev.getValueAsBuild(project); } catch (ExplicitException e) { /* show 'build not found' to user */ }

Prevention

When it happens

Trigger: 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).

Common situations: Referring to a build number from another project; build was purged/retention-deleted; query copied between projects with different numbering.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/a6cd466f2d1a8396. Report an issue: GitHub.

Appendix: source

Thrown at server-core/src/main/java/io/onedev/server/search/commit/Revision.java:62

	public Type getType() {
		return type;
	}

	@Nullable
	public String getValue() {
		return value;
	}

	public boolean isSince() {
		return since;
	}
	
	public Build getValueAsBuild(Project project) {
		var buildReference = BuildReference.of(value, project);
		var buildService = OneDev.getInstance(BuildService.class);
		var build = buildService.find(buildReference.getProject(), buildReference.getNumber());
		if (build == null)
			throw new ExplicitException("Unable to find build: " + value);
		else
			return build;
	}

	public RevCommit getRevCommit(Project project) {
		if (type == Type.BRANCH) {
			String branch = value;
			if (branch == null) {
				branch = project.getDefaultBranch();
				if (branch == null) 
					throw new ExplicitException("No default branch");
			}
			return project.getRevCommit(GitUtils.branch2ref(branch), true);
		} else if (type == Type.TAG) {
			return project.getRevCommit(GitUtils.tag2ref(value), true);
		} else if (type == Type.COMMIT) {
			return project.getRevCommit(value, true);
		} else if (type == Type.BUILD) {

View on GitHub (pinned to d44925c47c)