theonedev/onedev · error · ClientException
Package management not enabled for project '${project.path}'
Error message
Package management not enabled for project '${project.path}' What it means
checkProject throws ClientException with HTTP 406 (Not Acceptable) when the target project has the Package Management feature disabled. Every gem pack API request first resolves the project and checks project.isPackManagement(); if false, the request is rejected before any permission checks.
Source
Thrown at server-plugin/server-plugin-pack-gem/src/main/java/io/onedev/server/plugin/pack/gem/GemPackHandler.java:493
return pack;
dashIndex = nameAndVersion.indexOf('-', dashIndex + 1);
}
return null;
}
@Override
public String getApiKey(HttpServletRequest request) {
var authzHeader = request.getHeader(HttpHeaders.AUTHORIZATION);
if (authzHeader != null&& authzHeader.toLowerCase().startsWith("bearer "))
return StringUtils.substringAfter(authzHeader, " ");
else
return null;
}
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;
}
private UserMarshal getGemVersion(String version) {
return new UserMarshal("Gem::Version", newArrayList(version));
}
private UserMarshal getGemRequirement(Map<String, UserMarshal> requiredVersions) {
var requirements = new ArrayList<>();
for (var entry: requiredVersions.entrySet())
requirements.add(newArrayList(entry.getKey(), entry.getValue()));
var value = new ArrayList<>();
value.add(requirements);View on GitHub (pinned to d44925c47c)
Solutions
- Enable package management: Project -> Package Management -> enable, then retry the request.
- Confirm the projectId/URL used by the gem client points to the intended OneDev project.
- If using the API directly, pass the correct project id of a project with pack management enabled.
Example fix
// OneDev project settings (server side admin action) // Project -> General -> enable 'Package Management' # then gem push --host https://onedev.example.com/~project/gem mygem-1.0.0.gem
Defensive patterns
Strategy: validation
Validate before calling
// before pushing/fetching, confirm the project has pack management enabled // in OneDev UI: Project -> Package Management must be enabled // API check: GET /~api/projects/<id> and inspect packManagement === true
Try / catch
try {
pushGem(host, projectId, file);
} catch (ClientException e) {
if (e.getStatusCode() == 406) throw new IllegalStateException("Enable Package Management on project " + projectId, e);
throw e;
} Prevention
- Enable Package Management when creating any project that will host gems.
- Encode the enable-step into project provisioning/infrastructure-as-code templates.
- Keep publish scripts pointed at documented project ids.
When it happens
Trigger: Any GemPackHandler.handle request (publish, download, list) whose projectId references a project where Project -> Package Management toggle is off.
Common situations: Client (gem/publish or dependency fetch) pointed at a project URL in a repo where the admin never enabled package management; project created before the feature existed; admin disabled the feature after packages were published elsewhere.
Related errors
- 406
- Time tracking needs to be enabled for the project
- ${e.getMessage()}
- An active subscription is required for this feature
- Time tracking needs to be enabled for the project
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/189ac3e245de9ac2.
Report an issue: GitHub.