theonedev/onedev · error · ValidationException

Job not found (

Error message

Job not found (

What it means

In RunJobAction.validateWith, if the jobName of the action does not resolve to a job in the current build spec (jobToRun == null), a ValidationException 'Job not found (<jobName>)' is thrown instead of validating parameters.

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspec/job/action/RunJobAction.java:151

	}

	@Override
	public void validateWith(BuildSpec buildSpec, Job job) {
		super.validateWith(buildSpec, job);
		
		Job jobToRun = buildSpec.getJobMap().get(jobName);
		if (jobToRun != null) {
			try {
				ParamUtils.validateParamMatrix(jobToRun.getParamSpecs(), paramMatrix);
				for (var exludeParamMap: excludeParamMaps)
					ParamUtils.validateParamMap(jobToRun.getParamSpecs(), exludeParamMap.getParams());
			} catch (ValidationException e) {
				String errorMessage = String.format("Error validating job parameters (job: %s, error message: %s)", 
						jobToRun.getName(), e.getMessage());
				throw new ValidationException(errorMessage);
			}
		} else {
			throw new ValidationException("Job not found (" + jobName + ")");
		}
	}

}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Correct the `job` field to the exact name of a job defined in the same build spec (names are case-sensitive).
  2. Re-add the target job if it was deleted, or rename the action's reference after a job rename.
  3. If the job belongs to another project, import that build spec or use RunProjectJobAction instead.

Example fix

// before
- !RunJobAction
  job: deploy-to-prod
// after (job actually named)
- !RunJobAction
  job: Deploy to production
Defensive patterns

Strategy: validation

Validate before calling

var spec = project.getBuildSpec(commit);
if (spec == null || spec.getJobMap().get(jobName) == null)
    throw new IllegalArgumentException("Job not defined: " + jobName);

Try / catch

try { action.validateWith(buildSpec, job); } catch (ValidationException e) { correctJobReference(e.getMessage()); }

Prevention

When it happens

Trigger: validateWith(buildSpec, job) is called and buildSpec.getJobMap().get(jobName) yields nothing — the `job` field of the RunJobAction names a job absent from this project's build spec at validation time.

Common situations: Typo in the job name; the target job was renamed or deleted; the job lives in another project (should use RunProjectJobAction or an import); case mismatch between action and job definition.

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/79970984900034d3. Report an issue: GitHub.