theonedev/onedev · error · ValidationException

Dependency job not found (

Error message

Dependency job not found (

What it means

checkDependencies throws ValidationException 'Dependency job not found (<name>)' when a job dependency names a job that does not exist in the build spec's job map, checked at the top level (empty dependency chain). Nested jobs referencing missing jobs deeper in the chain are not flagged here.

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspec/BuildSpec.java:545

			} else {
				Job dependencyJob = getJobMap().get(dependency.getJobName());
				if (dependencyJob != null) {
					if (dependencyChain.isEmpty()) {
						try {
							ParamUtils.validateParamMatrix(dependencyJob.getParamSpecs(), dependency.getParamMatrix());
							for (var paramMap: dependency.getExcludeParamMaps())
								ParamUtils.validateParamMap(dependencyJob.getParamSpecs(), paramMap.getParams());
						} catch (ValidationException e) {
							String message = String.format("Error validating dependency job parameters (dependency job: %s, error message: %s)", 
									dependencyJob.getName(), e.getMessage());
							throw new ValidationException(message);
						}
					}
					List<String> newDependencyChain = new ArrayList<>(dependencyChain);
					newDependencyChain.add(dependency.getJobName());
					checkDependencies(dependencyJob, newDependencyChain);
				} else if (dependencyChain.isEmpty()) {
					throw new ValidationException("Dependency job not found (" + dependency.getJobName() + ")");
				}
			}
		}
	}
		
	@Nullable
	public static BuildSpec get() {
		BuildSpecAware buildSpecAware = HierarchicalContext.get().findData(BuildSpecAware.class);
		if (buildSpecAware != null) 
			return buildSpecAware.getBuildSpec();
		else
			return null;
	}
	
	public static List<InputSuggestion> suggestVariables(String matchWith, 
			boolean withBuildVersion, boolean withDynamicVariables, boolean withPauseCommand) {
		List<InputSuggestion> suggestions = new ArrayList<>();
		BuildSpec buildSpec = get();

View on GitHub (pinned to d44925c47c)

Solutions

  1. Add the referenced job to the build spec
  2. Correct the jobName to match an existing job (exact, case-sensitive name)
  3. Remove the dependency entry if the job was intentionally deleted
  4. Check that the imported spec (if using Import) resolves to the revision containing the job

Example fix

# before
- name: deploy
  jobDependencies: [{jobName: biuld}]   # typo
# after
- name: deploy
  jobDependencies: [{jobName: build}]
Defensive patterns

Strategy: validation

Validate before calling

for (var job : buildSpec.getJobs())
    for (var dep : job.getJobDependencies())
        if (!buildSpec.getJobMap().containsKey(dep.getJobName()))
            throw new ExplicitException("Unknown job dependency: " + dep.getJobName());

Try / catch

try {
    buildSpec.isValid();
} catch (ValidationException e) {
    // 'Dependency job not found (name)': add/rename/remove the dependency
}

Prevention

When it happens

Trigger: A jobDependencies entry's jobName does not match any job defined in the same build spec; fired during isValid().

Common situations: Renaming or deleting a job that other jobs still depend on; typos in jobName; depending on a job that exists only on another branch; building specs from imported revisions where the referenced job is absent.

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/2e45fdbbeb38b431. Report an issue: GitHub.