{"record":{"id":"7f39f3e034bc46ec","repo":"theonedev/onedev","slug":"package-name-should-be-lower-case","errorCode":null,"errorMessage":"Package name should be lower case","messagePattern":"Package name should be lower case","errorType":"http","errorClass":"ClientException","httpStatus":400,"severity":"error","filePath":"server-plugin/server-plugin-pack-cargo/src/main/java/io/onedev/server/plugin/pack/cargo/CargoPackHandler.java","lineNumber":153,"sourceCode":"\t\tObjectNode metadata;\n\t\ttry {\n\t\t\tvar metadataNode = objectMapper.readTree(upload.metadata);\n\t\t\tif (metadataNode instanceof ObjectNode)\n\t\t\t\tmetadata = (ObjectNode) metadataNode;\n\t\t\telse\n\t\t\t\tthrow new ClientException(SC_BAD_REQUEST, \"Invalid package metadata\");\n\t\t} catch (IOException e) {\n\t\t\tthrow new ClientException(SC_BAD_REQUEST, \"Invalid package metadata\");\n\t\t}\n\n\t\tvar name = metadata.path(\"name\").asText(null);\n\t\tvar version = metadata.path(\"vers\").asText(null);\n\t\tif (StringUtils.isBlank(name))\n\t\t\tthrow new ClientException(SC_BAD_REQUEST, \"Package name not specified\");\n\t\tif (StringUtils.isBlank(version))\n\t\t\tthrow new ClientException(SC_BAD_REQUEST, \"Package version not specified\");\n\t\tif (!name.equals(name.toLowerCase()))\n\t\t\tthrow new ClientException(SC_BAD_REQUEST, \"Package name should be lower case\");\n\t\tLockUtils.run(getLockName(projectId, name), () -> transactionService.run(() -> {\n\t\t\tvar project = checkProject(projectId, true);\n\t\t\tvar packBlobId = packBlobService.uploadBlob(projectId, upload.crateFile, null);\n\t\t\tvar packBlob = packBlobService.load(packBlobId);\n\t\t\tvar pack = packService.findByNameAndVersion(project, TYPE, name, version);\n\t\t\tif (pack == null) {\n\t\t\t\tpack = new Pack();\n\t\t\t\tpack.setType(TYPE);\n\t\t\t\tpack.setName(name);\n\t\t\t\tpack.setVersion(version);\n\t\t\t\tpack.setPrerelease(version.contains(\"-\"));\n\t\t\t\tpack.setProject(project);\n\t\t\t}\n\t\t\tpack.setData(new CargoData(upload.metadata, packBlob.getSha256Hash()));\n\t\t\tBuild build = null;\n\t\t\tif (buildId != null)\n\t\t\t\tbuild = buildService.load(buildId);\n\t\t\tpack.setBuild(build);","sourceCodeStart":135,"sourceCodeEnd":171,"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#L135-L171","documentation":"Naming-rule guard in CargoPackHandler.publish: the package name in the uploaded metadata is not lower case, but cargo registry names must be lower case; ClientException 400 rejects the publish. Fix: publish with an all-lower-case package name.","triggerScenarios":"Thrown at server-plugin/server-plugin-pack-cargo/src/main/java/io/onedev/server/plugin/pack/cargo/CargoPackHandler.java:153 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Lower-case the package name in Cargo.toml (cargo convention requires lowercase).","Normalize the name in the publish payload before uploading."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}