{"record":{"id":"3723a9362684e4e9","repo":"theonedev/onedev","slug":"package-management-not-enabled-for-project-proj-3723a9","errorCode":null,"errorMessage":"Package management not enabled for project '${projectPath}'","messagePattern":"Package management not enabled for project '(.+?)'","errorType":"http","errorClass":"ClientException","httpStatus":406,"severity":"error","filePath":"server-plugin/server-plugin-pack-pypi/src/main/java/io/onedev/server/plugin/pack/pypi/PypiPackHandler.java","lineNumber":301,"sourceCode":"\t}\n\n\t@Override\n\tpublic String getApiKey(HttpServletRequest request) {\n\t\treturn null;\n\t}\n\t\n\tprivate void sendResponse(HttpServletResponse response, String content) {\n\t\ttry {\n\t\t\tresponse.getOutputStream().print(content);\n\t\t} catch (IOException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t}\n\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 ClientException(SC_NOT_ACCEPTABLE, \"Package management not enabled for project '\" + project.getPath() + \"'\");\n\t\t} else if (needsToWrite && !SecurityUtils.canWritePack(project)) {\n\t\t\tthrow new UnauthorizedException(\"No package write permission for project: \" + project.getPath());\n\t\t} else if (!needsToWrite && !SecurityUtils.canReadPack(project)) {\n\t\t\tthrow new UnauthorizedException(\"No package read permission for project: \" + project.getPath());\n\t\t}\n\t\treturn project;\n\t}\n\n\t@Override\n\tpublic List<String> normalize(List<String> pathSegments) {\n\t\treturn pathSegments;\n\t}\n\n}\n","sourceCodeStart":283,"sourceCodeEnd":316,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-pack-pypi/src/main/java/io/onedev/server/plugin/pack/pypi/PypiPackHandler.java#L283-L316","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the project in OneDev, go to project settings and enable 'Package management'","Verify the project path/ID used by twine or pip matches the intended project","If enabled already, save project settings again to re-apply the flag"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"var project = projectService.load(projectId);\nif (!project.isPackManagement()) throw new IllegalStateException('Enable package management for project ' + project.getPath());","typeGuard":null,"tryCatchPattern":"try { ... } catch (ClientException e) { if (e.getHttpStatusCode() == 406) { enablePackManagementOrRedirect(); } }","preventionTips":["Enable package management on all projects that will host PyPI packages","Double-check the project path configured in pip/twine before publishing","Document the flag in onboarding for CI pipeline authors"],"tags":["http","configuration","pypi"],"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-14T00:17:10.932Z"}