{"record":{"id":"d6d8c6ef86d29dd9","repo":"theonedev/onedev","slug":"package-management-not-enabled-for-project-proj","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-cargo/src/main/java/io/onedev/server/plugin/pack/cargo/CargoPackHandler.java","lineNumber":386,"sourceCode":"\t}\n\n\tprivate void writeJson(HttpServletResponse response, Object object) {\n\t\tresponse.setContentType(MediaType.APPLICATION_JSON);\n\t\ttry {\n\t\t\tobjectMapper.writeValue(response.getOutputStream(), object);\n\t\t} catch (IOException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t}\n\n\tprivate String getLockName(Long projectId, String name) {\n\t\treturn \"update-pack:\" + projectId + \":\" + TYPE + \":\" + name;\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 String getApiKey(HttpServletRequest request) {\n\t\treturn request.getHeader(HttpHeaders.AUTHORIZATION);\n\t}\n\n\t@Override\n\tpublic List<String> normalize(List<String> pathSegments) {\n\t\treturn pathSegments;\n\t}\n","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-pack-cargo/src/main/java/io/onedev/server/plugin/pack/cargo/CargoPackHandler.java#L368-L404","documentation":"Thrown by CargoPackHandler.checkProject when the target project does not have package management enabled. The cargo registry endpoints refuse to operate on a project with isPackManagement() == false, responding with HTTP 406. This is a project-level feature gate, not a permission problem.","triggerScenarios":"Pointing cargo (e.g. registry index URL or publish config) at a OneDev project whose Package Management setting is off; project id resolved from the URL belongs to a non-pack project.","commonSituations":"Newly created project where 'Package Management' was never enabled in project settings; pointing CI cargo config at the wrong project path; project copied/imported without the setting.","solutions":["Enable 'Package Management' in Project -> Settings for the target project","Confirm the project path/id in your cargo registry config matches an enabled project","If the project shouldn't host packages, update .cargo/config.toml or publish config to the correct project"],"exampleFix":"// .cargo/config.toml — point at a pack-enabled project\n[registries.onedev]\nindex = \"sparse+https://onedev.example.com/~cargo/<correct-project>/index/\"","handlingStrategy":"validation","validationCode":"// check the project has pack management enabled before configuring cargo\n// GET /~api/projects/<path> and inspect packManagement, or verify in Project Settings UI","typeGuard":null,"tryCatchPattern":"try { execSync('cargo publish'); } catch (e) { if (/Package management not enabled/.test(e.message)) { /* enable in Project Settings */ } }","preventionTips":["Enable Package Management when creating projects used as registries","Double-check project path in .cargo/config.toml","Document registry project setup for teams"],"tags":["cargo","project-settings","configuration","registry"],"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"}