theonedev/onedev · error · NotFoundException

Unable to find project '${projectPath}'

Error message

Unable to find project '${projectPath}'

What it means

QueryUtils.getProject resolves a project path (like 'my-group/my-project') to a Project entity via ProjectService.findByPath. When no project exists at the given path, OneDev throws a NotFoundException with the offending path embedded in the message. It is a lookup helper used by query/criteria parsing code, so a bad path in a query value surfaces here.

Source

Thrown at server-core/src/main/java/io/onedev/server/util/QueryUtils.java:105

	
	public static User getUser(String loginName) {
		User user = OneDev.getInstance(UserService.class).findByName(loginName);
		if (user == null)
			throw new NotFoundException("Unable to find user with login: " + loginName);
		return user;
	}

	public static Group getGroup(String groupName) {
		Group group = OneDev.getInstance(GroupService.class).find(groupName);
		if (group == null)
			throw new NotFoundException("Unable to find group: " + groupName);
		return group;
	}
	
	public static Project getProject(String projectPath) {
		Project project = OneDev.getInstance(ProjectService.class).findByPath(projectPath);
		if (project == null)
			throw new NotFoundException("Unable to find project '" + projectPath + "'");
		return project;
	}
	
	public static boolean getBooleanValue(String value) {
		if (value.equals("true"))
			return true;
		else if (value.equals("false"))
			return false;
		else
			throw new NotAcceptableException("Invalid boolean: " + value);
	}
	
	public static Date getDateValue(String value) {
		Date dateValue = DateUtils.parseRelaxed(value);
		if (dateValue == null)
			throw new NotAcceptableException("Unrecognized date: " + value);
		return dateValue;
	}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Verify the project path exactly matches the project's path in OneDev (check the project URL in the web UI)
  2. Check whether the project was renamed, moved under a different group, or deleted and update the query/config accordingly
  3. Confirm the calling user has permission to see the project (findByPath may return null for inaccessible projects depending on caller context)
  4. Catch NotFoundException around the call and present a friendly 'project not found' message instead of a stack trace

Example fix

// before
Project project = QueryUtils.getProject("old-name/my-app");
// after
Project project = OneDev.getInstance(ProjectService.class).findByPath("correct-group/my-app");
if (project == null) throw new UserException("Project 'correct-group/my-app' does not exist");
Defensive patterns

Strategy: validation

Validate before calling

Project p = OneDev.getInstance(ProjectService.class).findByPath(projectPath);
if (p == null) throw new UserException("Project '" + projectPath + "' not found");

Type guard

boolean projectExists(String path) {
    return OneDev.getInstance(ProjectService.class).findByPath(path) != null;
}

Try / catch

try {
    Project p = QueryUtils.getProject(path);
} catch (NotFoundException e) {
    logger.warn("Unknown project path: {}", path);
    // surface a user-friendly message or fall back to a default project
}

Prevention

When it happens

Trigger: Calling QueryUtils.getProject(String projectPath) with a path that does not exist, is misspelled, or references a project the caller cannot see; also triggered indirectly from query parsers resolving criteria values like 'project:foo'.

Common situations: Typos in project paths in saved queries or criteria values; project renamed, moved, or deleted after a query was authored; wrong path separators (using '/' vs group nesting); referencing a project that was archived or the user lacks access to.

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