theonedev/onedev · error · NotFoundException

Project not found or inaccessible: ${path}

Error message

Project not found or inaccessible: ${path}

What it means

Thrown by GET /projects/ids/{path} when the project at the given path cannot be found (projectService.findByPath returns null). It is a JAX-RS NotFoundException mapped to HTTP 404. OneDev deliberately returns the same message for missing and inaccessible projects so callers cannot probe for existence.

Source

Thrown at server-core/src/main/java/io/onedev/server/rest/resource/ProjectResource.java:120

		
	@Api(order=100)
	@Path("/{projectId}")
    @GET
    public ProjectData getProject(@PathParam("projectId") Long projectId) {
    	Project project = projectService.load(projectId);
    	if (!SecurityUtils.canAccessProject(project))
			throw new UnauthorizedException();
     	return ProjectData.from(project);
    }

	@Api(order=125)
	@Path("/ids/{path:.*}")
	@GET
	public Long getProjectId(@PathParam("path") String path) {
		var project = projectService.findByPath(path);
		if (project != null) {
			if (!SecurityUtils.canAccessProject(project))
				throw new NotFoundException("Project not found or inaccessible: " + path);
			return project.getId();
		} else {
			throw new NotFoundException("Project not found or inaccessible: " + path);
		}
	}
	
	@Api(order=150)
	@Path("/{projectId}/clone-url")
    @GET
    public CloneUrl getCloneURL(@PathParam("projectId") Long projectId) {
    	Project project = projectService.load(projectId);
    	if (!SecurityUtils.canAccessProject(project))
			throw new UnauthorizedException();

    	CloneUrl cloneUrl = new CloneUrl();
    	cloneUrl.setHttp(urlService.cloneUrlFor(project, false));
    	cloneUrl.setSsh(urlService.cloneUrlFor(project, true));
    	

View on GitHub (pinned to d44925c47c)

Solutions

  1. Verify the exact project path in the OneDev UI (Projects page URL) and correct the path in the API call.
  2. For personal projects, include the owner prefix, e.g. /~api/projects/ids/~john/project.
  3. Confirm the project still exists and was not renamed/deleted; recreate or update references accordingly.
  4. Check you are authenticating as a user with access — inaccessible projects also return 404 (indistinguishable by design).

Example fix

// before
GET /~api/projects/ids/my-project  // 404 if it is a personal project
// after
GET /~api/projects/ids/~alice/my-project
Defensive patterns

Strategy: try-catch

Validate before calling

// resolve with the exact path shown in the UI, including owner prefix
const path = '~alice/my-project';
if (!path || path.trim() === '') throw new Error('project path required');
// optionally GET /~api/projects?query="Name" is "my-project" first to confirm existence

Try / catch

try {
  const id = await api.get(`/~api/projects/ids/${encodeURIComponent(path)}`);
} catch (e) {
  if (e.status === 404) {
    // treat as 'missing OR no access': verify path, owner prefix, and credentials
  } else throw e;
}

Prevention

When it happens

Trigger: Calling GET /~api/projects/ids/{path} with a path that does not match any project (e.g. typo, project deleted, wrong case, path missing the owner prefix like ~user/project).

Common situations: CI scripts referencing a renamed or deleted project; clients omitting the user namespace prefix for personal projects; stale configs after a server migration; case-sensitivity mismatches in the path.

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