theonedev/onedev · error · ValidationException

Reference project not found: <projectPath>

Error message

Reference project not found: <projectPath>

What it means

EntityReference.of resolves the 'path#number' form by looking up projectService.findByPath(projectPath). If no project exists with that path, a ValidationException 'Reference project not found' is thrown. The reference syntax is valid but the named project does not exist (or is not visible).

Source

Thrown at server-core/src/main/java/io/onedev/server/entityreference/EntityReference.java:79

	}

	public static EntityReference of(String type, String referenceString, @Nullable Project currentProject) {
		var projectService = OneDev.getInstance(ProjectService.class);
		var index = referenceString.indexOf('#');
		if (index != -1) {
			var projectPath = referenceString.substring(0, index);
			var number = parseReferenceNumber(referenceString.substring(index + 1));
			if (projectPath.length() == 0) {
				if (currentProject != null)
					return EntityReference.of(type, currentProject, number);
				else
					throw new ValidationException("Reference project not specified: " + referenceString);
			} else {
				var project = projectService.findByPath(projectPath);
				if (project != null)
					return EntityReference.of(type, project, number);
				else
					throw new ValidationException("Reference project not found: " + projectPath);
			}
		}
		index = referenceString.indexOf('-');
		if (index != -1) {
			var projectKey = referenceString.substring(0, index);
			var number = parseReferenceNumber(referenceString.substring(index + 1));
			var project = projectService.findByKey(projectKey);
			if (project != null)
				return EntityReference.of(type, project, number);
			else
				throw new ValidationException("Reference project not found with key: " + projectKey);
		}
		try {
			var number = Long.valueOf(referenceString);
			if (currentProject != null)
				return EntityReference.of(type, currentProject, number);
			else
				throw new ValidationException("Reference project not specified: " + referenceString);

View on GitHub (pinned to d44925c47c)

Solutions

  1. Correct the project path in the reference string to an existing project's path.
  2. Verify the project still exists and was not renamed or deleted.
  3. Check whether the target project is accessible (permissions/visibility) in the current context.
  4. Use the project key form ("KEY-123") if the path is unknown.

Example fix

// before
EntityReference.of("issue", "old-proj#12", null);
// after
EntityReference.of("issue", "renamed-proj#12", null);
Defensive patterns

Strategy: validation

Validate before calling

int i = referenceString.indexOf('#');
String path = i > 0 ? referenceString.substring(0, i) : null;
if (path != null && projectService.findByPath(path) == null)
    throw new IllegalArgumentException("Unknown project path: " + path);

Try / catch

try {
    EntityReference ref = EntityReference.of("issue", input, currentProject);
} catch (ValidationException e) {
    if (e.getMessage().startsWith("Reference project not found:")) {
        // suggest existing project paths to the user
    }
}

Prevention

When it happens

Trigger: Calling EntityReference.of(type, "some/path#123", ...) where findByPath("some/path") returns null — misspelled path, deleted/renamed project, or path containing the wrong case/segment.

Common situations: Renamed or deleted projects breaking old references in issue text/links; typos in project path in markdown references; cross-project references to private projects.

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/157302a89d3de811. Report an issue: GitHub.