{"record":{"id":"ca9c39696a2efa13","repo":"theonedev/onedev","slug":"unable-to-find-dependency-build-in-project-de","errorCode":null,"errorMessage":"Unable to find dependency build in project '\" + dependencyProject.getPath() + \"'","messagePattern":"Unable to find dependency build in project '\" \\+ dependencyProject\\.getPath\\(\\) \\+ \"'","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/job/DefaultJobService.java","lineNumber":419,"sourceCode":"\n\t\t\t\tSubject subject;\n\t\t\t\tif (dependency.getAccessTokenSecret() != null) {\n\t\t\t\t\tString secretValue = build.getJobAuthorizationContext().getSecretValue(dependency.getAccessTokenSecret());\n\t\t\t\t\tvar accessToken = accessTokenService.findByValue(secretValue);\n\t\t\t\t\tif (accessToken == null) {\n\t\t\t\t\t\tthrow new ExplicitException(\"Unable to access dependency project '\"\n\t\t\t\t\t\t\t\t+ dependency.getProjectPath() + \"': invalid access token\");\n\t\t\t\t\t}\n\t\t\t\t\tsubject = accessToken.asSubject();\n\t\t\t\t} else {\n\t\t\t\t\tsubject = SecurityUtils.asAnonymous();\n\t\t\t\t}\n\n\t\t\t\tBuild dependencyBuild = dependency.getBuildProvider().getBuild(dependencyProject);\n\t\t\t\tif (dependencyBuild == null) {\n\t\t\t\t\tString errorMessage = String.format(\"Unable to find dependency build in project '\"\n\t\t\t\t\t\t\t+ dependencyProject.getPath() + \"'\");\n\t\t\t\t\tthrow new ExplicitException(errorMessage);\n\t\t\t\t}\n\n\t\t\t\tAccessProject projectPermission = new AccessProject();\n\t\t\t\tif (!dependencyProject.isPermittedByLoginUser(projectPermission)\n\t\t\t\t\t\t&& !subject.isPermitted(new ProjectPermission(dependencyProject, projectPermission))) {\n\t\t\t\t\tthrow new ExplicitException(\"Unable to access dependency build '\"\n\t\t\t\t\t\t\t+ dependencyBuild.getReference().toString(null) + \"': permission denied\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (build.getDependencies().stream()\n\t\t\t\t\t\t.anyMatch(it -> it.getDependency().equals(dependencyBuild))) {\n\t\t\t\t\tthrow new ExplicitException(\"Duplicate dependency build '\"\n\t\t\t\t\t\t\t+ dependencyBuild.getReference().toString(null) + \"'\");\n\t\t\t\t}\n\n\t\t\t\tBuildDependence dependence = new BuildDependence();\n\t\t\t\tdependence.setDependency(dependencyBuild);\n\t\t\t\tdependence.setDependent(build);","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/job/DefaultJobService.java#L401-L437","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Trigger a successful build in the dependency project first, then resubmit this build.","Check the dependency's build provider configuration (branch/ref/build number) points at something that exists.","Review build retention/cleanup settings if dependency builds were deleted.","Verify the dependency project's own build spec defines the jobs needed to produce a build."],"exampleFix":"// before\n- projectName: core-lib\n  buildProvider: !BranchBuildProvider\n    branch: release   # branch never built\n// after\n- projectName: core-lib\n  buildProvider: !BranchBuildProvider\n    branch: main","handlingStrategy":"retry","validationCode":"Build depBuild = dep.getBuildProvider().getBuild(depProject);\nif (depBuild == null) throw new ExplicitException(\"No build available in \" + depProject.getPath() + \"; trigger one first\");","typeGuard":null,"tryCatchPattern":"try { jobService.submit(...); } catch (ExplicitException e) { if (e.getMessage().contains(\"Unable to find dependency build\")) triggerDependencyThenRetry(); throw e; }","preventionTips":["Keep dependency branches building regularly so a build always exists","Point build providers at stable refs (e.g. main) rather than rarely-built branches","Set retention policies that never delete the latest successful build of dependency projects"],"tags":["ci","dependency","build"],"backgroundTag":"resource-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"}