{"record":{"id":"239dd89a8ceca0b7","repo":"theonedev/onedev","slug":"package-management-not-enabled-for-project-proj-239dd8","errorCode":null,"errorMessage":"Package management not enabled for project '${project.getPath()}'","messagePattern":"Package management not enabled for project '(.+?)'","errorType":"http","errorClass":"HttpResponseAwareException","httpStatus":406,"severity":"error","filePath":"server-plugin/server-plugin-pack-maven/src/main/java/io/onedev/server/plugin/pack/maven/MavenPackHandler.java","lineNumber":432,"sourceCode":"\t\t\t\t\t\tfor (var blobReference: pack.getBlobReferences()) {\n\t\t\t\t\t\t\tif (blobReference.getPackBlob().getSha256Hash().equals(prevSha256BlobHash)) {\n\t\t\t\t\t\t\t\tpackBlobReferenceService.delete(blobReference);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tresponse.setStatus(SC_CREATED);\n\t\t\t\t}));\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t}\n\t\n\tprivate Project checkProject(Long projectId, boolean needsToWrite) {\n\t\tvar project = projectService.load(projectId);\n\t\tif (!project.isPackManagement())\n\t\t\tthrow new HttpResponseAwareException(SC_NOT_ACCEPTABLE, \"Package management not enabled for project '\" + project.getPath() + \"'\");\n\t\telse if (needsToWrite && !SecurityUtils.canWritePack(project))\n\t\t\tthrow new UnauthorizedException(\"No package write permission for project: \" + project.getPath());\n\t\telse if (!needsToWrite && !SecurityUtils.canReadPack(project))\n\t\t\tthrow new UnauthorizedException(\"No package read permission for project: \" + project.getPath());\n\t\treturn project;\n\t}\n\t\n\tprivate String getName(String groupId, @Nullable String artifactId) {\n\t\tif (artifactId == null)\n\t\t\tartifactId = NONE;\n\t\treturn groupId + \":\" + artifactId;\n\t}\n\t\n\tprivate List<Pack> queryByGAWithV(Project project, String groupId, String artifactId) {\n\t\tvar criteria = EntityCriteria.of(Pack.class);\n\t\tcriteria.add(Restrictions.eq(PROP_PROJECT, project));\n\t\tcriteria.add(Restrictions.eq(PROP_TYPE, TYPE));\n\t\tcriteria.add(Restrictions.eq(PROP_NAME, getName(groupId, artifactId)));","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-pack-maven/src/main/java/io/onedev/server/plugin/pack/maven/MavenPackHandler.java#L414-L450","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before — Maven settings pointing at disabled project\n<url>https://onedev.example.com/~maven/2</url>\n// after — enable Pack Management on project 2 in UI, or point at project 1 where it is enabled\n<url>https://onedev.example.com/~maven/1</url>","handlingStrategy":"validation","validationCode":"// Check the project setting before configuring the repository\nasync function assertPackManagementEnabled(baseUrl, projectId, token) {\n  const res = await fetch(`${baseUrl}/~api/projects/${projectId}`, { headers: { Authorization: `Bearer ${token}` } });\n  if (!res.ok) throw new Error(`cannot load project ${projectId}: HTTP ${res.status}`);\n  const project = await res.json();\n  if (!project.packManagement) throw new Error(`enable Pack Management on project ${projectId} before using its Maven repo`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["maven","feature-flag","project-settings","http-406"],"backgroundTag":"feature-not-enabled","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}