theonedev/onedev · error · HttpResponseAwareException

Package management not enabled for project '${project.getPat

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.

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)

Solutions

  1. Enable pack management: Project > ( administration/settings ) > turn on 'Pack management' / Maven package repository.
  2. Confirm the repository URL references the intended project (right project id/path).
  3. 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

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


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