theonedev/onedev · error · HttpResponseAwareException
Package management not enabled for project
Error message
Package management not enabled for project '${project.getPath()}' What it means
checkProject loads the project by id and, if the project does not have the Maven pack repository feature turned on (project.isPackManagement() is false), rejects the request with HTTP 406 'Package management not enabled'. Maven artifact endpoints simply do not exist for projects without this feature enabled.
Solutions
- Enable pack management: Project > ( administration/settings ) > turn on 'Pack management' / Maven package repository.
- Confirm the repository URL references the intended project (right project id/path).
- Re-check the setting after project import/restore — it is not always copied over.
Example fix
// before — Maven settings pointing at disabled project <url>https://onedev.example.com/~maven/2</url> // after — enable Pack Management on project 2 in UI, or point at project 1 where it is enabled <url>https://onedev.example.com/~maven/1</url>
Defensive patterns
Strategy: validation
Validate before calling
// Check the project setting before configuring the repository
async function assertPackManagementEnabled(baseUrl, projectId, token) {
const res = await fetch(`${baseUrl}/~api/projects/${projectId}`, { headers: { Authorization: `Bearer ${token}` } });
if (!res.ok) throw new Error(`cannot load project ${projectId}: HTTP ${res.status}`);
const project = await res.json();
if (!project.packManagement) throw new Error(`enable Pack Management on project ${projectId} before using its Maven repo`);
} Prevention
- Enable Pack Management when creating the project, as part of project bootstrap templates.
- Document the project id in repository URLs so the right project is targeted.
- Re-enable the setting after project import/restore from templates.
When it happens
Trigger: Any GET (serve) or PUT (upload) against the project's Maven pack endpoint when the project's 'Pack management' setting is disabled — checked by both the read path and uploadBlob via checkProject.
Common situations: Freshly created project where the feature was never toggled on; repository URL pointing at the wrong project id; setting turned off after artifacts were published; cloning repo configs without enabling pack management.
Related errors
- Issue management not enabled in this project
- Time tracking needs to be enabled for the project
- 406
- An active subscription is required for this feature
- Another pull request already opened for this change
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/239dd89a8ceca0b7.
Report an issue: GitHub.
Appendix: source
Thrown at server-plugin/server-plugin-pack-maven/src/main/java/io/onedev/server/plugin/pack/maven/MavenPackHandler.java:432
for (var blobReference: pack.getBlobReferences()) {
if (blobReference.getPackBlob().getSha256Hash().equals(prevSha256BlobHash)) {
packBlobReferenceService.delete(blobReference);
break;
}
}
}
response.setStatus(SC_CREATED);
}));
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private Project checkProject(Long projectId, boolean needsToWrite) {
var project = projectService.load(projectId);
if (!project.isPackManagement())
throw new HttpResponseAwareException(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 String getName(String groupId, @Nullable String artifactId) {
if (artifactId == null)
artifactId = NONE;
return groupId + ":" + artifactId;
}
private List<Pack> queryByGAWithV(Project project, String groupId, String artifactId) {
var criteria = EntityCriteria.of(Pack.class);
criteria.add(Restrictions.eq(PROP_PROJECT, project));
criteria.add(Restrictions.eq(PROP_TYPE, TYPE));
criteria.add(Restrictions.eq(PROP_NAME, getName(groupId, artifactId)));View on GitHub (pinned to d44925c47c)