theonedev/onedev · error · ExplicitException

Project not found:

Error message

Project not found: 

What it means

The LFS authentication SSH command (LfsAuthenticateCommand.start) resolves the project by path via projectService.findByPath, stripping a trailing '.git' once if needed. If no project matches, it throws ExplicitException("Project not found: <path>") — the clone/LFS URL cannot be built for a non-existent or inaccessible project path.

Source

Thrown at server-core/src/main/java/io/onedev/server/git/LfsAuthenticateCommand.java:108

    public void start(ChannelSession channel, Environment env) throws IOException {
    	SshAuthenticator authenticator = OneDev.getInstance(SshAuthenticator.class);
    	Long userId = authenticator.getPublicKeyOwnerId(session);
    	OneDev.getInstance(ExecutorService.class).submit(() -> {
			SessionService sessionService = OneDev.getInstance(SessionService.class);
			sessionService.openSession(); 
			try {
				String accessToken = OneDev.getInstance(AccessTokenService.class).createTemporal(userId, 300);
				String projectPath = StringUtils.strip(StringUtils.substringBefore(
						commandString.substring(COMMAND_PREFIX.length()+1), " "), "/\\");
				
				var projectService = OneDev.getInstance(ProjectService.class);
				var project = projectService.findByPath(projectPath);
				if (project == null && projectPath.endsWith(".git")) {
					projectPath = StringUtils.substringBeforeLast(projectPath, ".");
					project = projectService.findByPath(projectPath);
				}
				if (project == null)
					throw new ExplicitException("Project not found: " + projectPath);
				String url = OneDev.getInstance(UrlService.class).cloneUrlFor(project, false);
				Map<Object, Object> response = CollectionUtils.newHashMap(
						"href", url + "/info/lfs", 
						"header", CollectionUtils.newHashMap(
								"Authorization", KubernetesHelper.BEARER + " " + accessToken)); 
				out.write(OneDev.getInstance(ObjectMapper.class).writeValueAsBytes(response));
				callback.onExit(0);
			} catch (Exception e) {
				logger.error("Error executing " + COMMAND_PREFIX, e);
				new PrintStream(err).println("Check server log for details");
				callback.onExit(-1);
			} finally {                
				sessionService.closeSession();
			}
		});
    }

    @Override

View on GitHub (pinned to d44925c47c)

Solutions

  1. Check the project path exists (path and case) under the OneDev instance
  2. Verify the user's access token/account can read the project (inaccessible projects look like missing ones)
  3. Remove the extra suffix — only one '.git' is stripped, so use the exact project path or path + '.git'
  4. Re-clone or update the remote URL with 'onedev' host alias if the server URL changed

Example fix

# before
git lfs authenticate ssh://user@server/my/repo.gIt  # case mismatch -> Project not found
# after
git lfs authenticate ssh://user@server/my/repo.git  # exact path, readable by user
Defensive patterns

Strategy: validation

Validate before calling

// client-side sanity before running lfs-authenticate
var path = uri.getPath().replaceAll("^/", "");
if (!path.endsWith(".git")) path += ".git";
// only one '.git' is stripped server-side; ensure the base path is exact and readable

Try / catch

try {
  runLfsAuthenticate();
} catch (ExplicitException e) {
  if (e.getMessage().startsWith("Project not found")) {
    // verify project path, case, and user read access
  }
}

Prevention

When it happens

Trigger: Running 'git lfs authenticate' (or the ssh lfs-authenticate command) against a project path that does not exist, is misspelled, has wrong case, or is not visible to the authenticated user; only a single '.git' suffix is stripped, so paths like repo.git.git fail.

Common situations: Typo in the remote URL; project renamed or deleted; user lacking read access (findByPath returns null for inaccessible projects); wrong OneDev server URL in the remote.

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