theonedev/onedev · error · NotFoundException

NAME_UNKNOWN

NAME_UNKNOWN

Error message

Unknown project: ${projectPath}

What it means

checkProject resolves the project path embedded in the registry URL via projectService.findByPath; if no project matches, a 404 NotFoundException with OCI code NAME_UNKNOWN is thrown. The registry API reports unknown namespaces this way so clients know the repository name does not exist.

Solutions

  1. Verify the project path in the image name exactly matches an existing OneDev project (case-sensitive path).
  2. Create the project if it does not exist.
  3. If the project was renamed, update image tags/CI references to the new path.

Example fix

// before
docker push registry.example.com/wrong-path/app:1.0
// after
docker push registry.example.com/correct-project/app:1.0
Defensive patterns

Strategy: validation

Validate before calling

// verify the project path exists before push/pull
curl -u user:token https://onedev.example.com/api/projects?path=correct-project

Try / catch

try { push() } catch (e) { if (e.httpStatus === 404 && e.code === 'NAME_UNKNOWN') { createProjectOrFixPath(); } else { throw e; } }

Prevention

When it happens

Trigger: Any registry API call (/v2/<projectPath>/...) where <projectPath> does not match an existing OneDev project path — typo in the image name, project renamed/deleted, or wrong casing.

Common situations: docker push/pull to a project that was deleted or renamed; mistyped image name (e.g. wrong path segment or trailing slash); pushing to a project that was never created.

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

Appendix: source

Thrown at server-plugin/server-plugin-pack-container/src/main/java/io/onedev/server/plugin/pack/container/ContainerServlet.java:516

	}
	
	private boolean isTag(String reference) {
		return !reference.contains(":");
	}
	
	private Digest parseDigest(String digestString) {
		if (digestString.startsWith("sha256:")) {
			return new Digest(SHA256, digestString.substring("sha256:".length()));
		} else {
			throw new ClientException(SC_NOT_ACCEPTABLE, ErrorCode.UNSUPPORTED, 
					"Unsupported digest: " + digestString);
		}
	}
	
	private Project checkProject(String projectPath, boolean needsToPush) {
		var project = projectService.findByPath(projectPath);
		if (project == null) 
			throw new NotFoundException(ErrorCode.NAME_UNKNOWN, "Unknown project: " + projectPath);
		else if (!project.isPackManagement())
			throw new ClientException(SC_NOT_ACCEPTABLE, ErrorCode.DENIED, "Package management not enabled for project: " + projectPath);
		else if (needsToPush && !SecurityUtils.canWritePack(project))
			throw new UnauthorizedException("No package write permission for project: " + project.getPath());
		else if (!needsToPush && !SecurityUtils.canReadPack(project))
			throw new UnauthorizedException("No package read permission for project: " + project.getPath());
		else
			return project;
	}

	private String getChallenge() {
		var serverUrl = settingService.getSystemSetting().getServerUrl();
		return "Bearer realm=\"" + serverUrl + "/v2/token\",service=\"onedev\",scope=\"*\"";
	}
	
}

View on GitHub (pinned to d44925c47c)