theonedev/onedev · error · EntityNotFoundException
Project not found or inaccessible: <projectPath>
Error message
Project not found or inaccessible: <projectPath>
What it means
reportProjectNotFoundOrInaccessible throws EntityNotFoundException when the project path extracted from a git HTTP request does not resolve to a project facade via projectService.findFacadeByPath, or the current user cannot see it. It deliberately hides whether the project is missing versus inaccessible to avoid information disclosure.
Source
Thrown at server-core/src/main/java/io/onedev/server/git/GitFilter.java:109
return StringUtils.stripStart(pathInfo, "/");
}
private Long getProjectId(String projectPath, boolean clusterAccess, boolean upload) {
var facade = projectService.findFacadeByPath(projectPath);
if (facade == null && projectPath.endsWith(".git")) {
projectPath = StringUtils.substringBeforeLast(projectPath, ".");
facade = projectService.findFacadeByPath(projectPath);
}
if (StringUtils.isBlank(projectPath))
throw new ExplicitException("Project not specified");
if (facade == null)
reportProjectNotFoundOrInaccessible(projectPath);
return facade.getId();
}
private void reportProjectNotFoundOrInaccessible(String projectPath) {
if (SecurityUtils.getUser() != null)
throw new EntityNotFoundException("Project not found or inaccessible: " + projectPath);
else
throw new UnauthorizedException("Authentication required");
}
private void doNotCache(HttpServletResponse response) {
response.setHeader("Expires", "Fri, 01 Jan 1980 00:00:00 GMT");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate");
}
protected void processPack(final HttpServletRequest request, final HttpServletResponse response)
throws IOException, InterruptedException, ExecutionException {
boolean upload = GitSmartHttpTools.isUploadPack(request);
String pathInfo = getPathInfo(request);
String service = StringUtils.substringAfterLast(pathInfo, "/");
String projectInfo = StringUtils.substringBeforeLast(pathInfo, "/");
View on GitHub (pinned to d44925c47c)
Solutions
- Verify the exact project path in OneDev UI and use it verbatim in the remote URL
- Check that the project still exists and was not renamed/deleted
- Confirm your user has at least read (code pull) permission on the project
- Re-login so your session/token reflects current permissions
Example fix
// before git clone https://onedev.example.com/myProjct.git // after git clone https://onedev.example.com/myproject.git
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check project existence/permission via OneDev REST API
const res = await fetch(`${server}/api/projects?path=${encodeURIComponent(projectPath)}`);
if (res.status === 401 || !res.ok) throw new Error('Project ' + projectPath + ' missing or inaccessible'); Try / catch
try {
git.fetch();
} catch (EntityNotFoundException e) {
// message starts with 'Project not found or inaccessible'
refreshProjectListAndPermissions();
} Prevention
- Copy project paths from the OneDev UI instead of typing them
- Keep project membership and tokens in sync after role changes
- Re-login/re-issue tokens after permission changes
When it happens
Trigger: getProjectId, processPack, or processRefs called with a projectPath that returns null from findFacadeByPath (after the .git-suffix retry), while SecurityUtils.getUser() != null (an authenticated or anonymous-but-known session).
Common situations: Cloning a project that was renamed, moved, or deleted; typo in project path; user lacks read access to a private project; running under an account whose membership was revoked; case-sensitivity or encoded-path mismatch in the URL.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Project not specified
- Authentication required
- Branch not exist:
- Unauthorized
- Project not found: ${projectPath}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/73a7f4f316ddabf1.
Report an issue: GitHub.