theonedev/onedev · error · ClientException

Package management not enabled for project '${projectPath}'

Error message

Package management not enabled for project '${projectPath}'

What it means

checkProject throws a ClientException with HTTP 406 when the target project does not have package management enabled. PyPI repository endpoints refuse to serve any package operations on such projects.

Source

Thrown at server-plugin/server-plugin-pack-pypi/src/main/java/io/onedev/server/plugin/pack/pypi/PypiPackHandler.java:301

	}

	@Override
	public String getApiKey(HttpServletRequest request) {
		return null;
	}
	
	private void sendResponse(HttpServletResponse response, String content) {
		try {
			response.getOutputStream().print(content);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	private Project checkProject(Long projectId, boolean needsToWrite) {
		var project = projectService.load(projectId);
		if (!project.isPackManagement()) {
			throw new ClientException(SC_NOT_ACCEPTABLE, "Package management not enabled for project '" + project.getPath() + "'");
		} else if (needsToWrite && !SecurityUtils.canWritePack(project)) {
			throw new UnauthorizedException("No package write permission for project: " + project.getPath());
		} else if (!needsToWrite && !SecurityUtils.canReadPack(project)) {
			throw new UnauthorizedException("No package read permission for project: " + project.getPath());
		}
		return project;
	}

	@Override
	public List<String> normalize(List<String> pathSegments) {
		return pathSegments;
	}

}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Open the project in OneDev, go to project settings and enable 'Package management'
  2. Verify the project path/ID used by twine or pip matches the intended project
  3. If enabled already, save project settings again to re-apply the flag

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

var project = projectService.load(projectId);
if (!project.isPackManagement()) throw new IllegalStateException('Enable package management for project ' + project.getPath());

Try / catch

try { ... } catch (ClientException e) { if (e.getHttpStatusCode() == 406) { enablePackManagementOrRedirect(); } }

Prevention

When it happens

Trigger: Calling any PyPI pack endpoint (upload via twine, pip install from the OneDev simple index, project() lookups) with a projectId whose project.isPackManagement() returns false.

Common situations: Project was created before the pack management feature was enabled; admin turned off 'Package management' in project settings; twine/pip pointed at the wrong project path.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/3723a9362684e4e9. Report an issue: GitHub.