theonedev/onedev · error · ExplicitException

Unable to find dependency build in project '" + dependencyPr

Error message

Unable to find dependency build in project '" + dependencyProject.getPath() + "'

What it means

After resolving the dependency project and access subject, doSubmit asks the dependency's build provider (dependency.getBuildProvider().getBuild(dependencyProject)) for the specific build to depend on, e.g. the latest successful build on a branch/ref. If the provider cannot produce any build for that project, an ExplicitException is thrown saying no dependency build was found in that project.

Source

Thrown at server-core/src/main/java/io/onedev/server/job/DefaultJobService.java:419

				Subject subject;
				if (dependency.getAccessTokenSecret() != null) {
					String secretValue = build.getJobAuthorizationContext().getSecretValue(dependency.getAccessTokenSecret());
					var accessToken = accessTokenService.findByValue(secretValue);
					if (accessToken == null) {
						throw new ExplicitException("Unable to access dependency project '"
								+ dependency.getProjectPath() + "': invalid access token");
					}
					subject = accessToken.asSubject();
				} else {
					subject = SecurityUtils.asAnonymous();
				}

				Build dependencyBuild = dependency.getBuildProvider().getBuild(dependencyProject);
				if (dependencyBuild == null) {
					String errorMessage = String.format("Unable to find dependency build in project '"
							+ dependencyProject.getPath() + "'");
					throw new ExplicitException(errorMessage);
				}

				AccessProject projectPermission = new AccessProject();
				if (!dependencyProject.isPermittedByLoginUser(projectPermission)
						&& !subject.isPermitted(new ProjectPermission(dependencyProject, projectPermission))) {
					throw new ExplicitException("Unable to access dependency build '"
							+ dependencyBuild.getReference().toString(null) + "': permission denied");
				}
				
				if (build.getDependencies().stream()
						.anyMatch(it -> it.getDependency().equals(dependencyBuild))) {
					throw new ExplicitException("Duplicate dependency build '"
							+ dependencyBuild.getReference().toString(null) + "'");
				}

				BuildDependence dependence = new BuildDependence();
				dependence.setDependency(dependencyBuild);
				dependence.setDependent(build);

View on GitHub (pinned to d44925c47c)

Solutions

  1. Trigger a successful build in the dependency project first, then resubmit this build.
  2. Check the dependency's build provider configuration (branch/ref/build number) points at something that exists.
  3. Review build retention/cleanup settings if dependency builds were deleted.
  4. Verify the dependency project's own build spec defines the jobs needed to produce a build.

Example fix

// before
- projectName: core-lib
  buildProvider: !BranchBuildProvider
    branch: release   # branch never built
// after
- projectName: core-lib
  buildProvider: !BranchBuildProvider
    branch: main
Defensive patterns

Strategy: retry

Validate before calling

Build depBuild = dep.getBuildProvider().getBuild(depProject);
if (depBuild == null) throw new ExplicitException("No build available in " + depProject.getPath() + "; trigger one first");

Try / catch

try { jobService.submit(...); } catch (ExplicitException e) { if (e.getMessage().contains("Unable to find dependency build")) triggerDependencyThenRetry(); throw e; }

Prevention

When it happens

Trigger: doSubmit (via submit or dependencyBuild) when the dependency's build provider (e.g. a branch/prefixed ref or build number) matches no existing build in the dependency project — dependency project never built, wrong ref name in the provider, or all builds pruned/deleted.

Common situations: Depending on another project's branch that has never run a build; build provider configured with an incorrect ref or build number; retention policies removed all builds of the dependency project; dependency project's spec removed so nothing can build.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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