{"record":{"id":"1734a12450bfa885","repo":"theonedev/onedev","slug":"400","errorCode":null,"errorMessage":"400","messagePattern":"400","errorType":"http","errorClass":"ClientException","httpStatus":400,"severity":"error","filePath":"server-plugin/server-plugin-pack-nuget/src/main/java/io/onedev/server/plugin/pack/nuget/NugetPackHandler.java","lineNumber":327,"sourceCode":"\t\t\t\t\t\t\t\t\tvar data = (NugetData) pack.getData();\n\t\t\t\t\t\t\t\t\tvar nupkgBlob = packBlobService.findBySha256Hash(projectId, data.getNupkgBlobSha256Hash());\n\t\t\t\t\t\t\t\t\tif (nupkgBlob != null)\n\t\t\t\t\t\t\t\t\t\tpackBlobs.add(nupkgBlob);\n\n\t\t\t\t\t\t\t\t\tpack.setData(new NugetData(data.getNupkgBlobSha256Hash(), snupkgBlob.getSha256Hash(), \n\t\t\t\t\t\t\t\t\t\t\tdata.getMetadata()));\n\t\t\t\t\t\t\t\t\tpackService.createOrUpdate(pack, packBlobs, false);\n\t\t\t\t\t\t\t\t\tresponse.setStatus(SC_CREATED);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t} catch (ParseException e) {\n\t\t\t\t\t\t\tlogger.warn(\"Package version is not a SemVer v2 compatible version\");\n\t\t\t\t\t\t\tthrow new ClientException(SC_BAD_REQUEST);\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tFileUtils.deleteFile(tempFile);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new ClientException(SC_BAD_REQUEST);\n\t\t\t\t\t}\n\t\t\t\t} catch (FileUploadException | IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t} else if (isDelete) {\n\t\t\t\tif (pathSegments.isEmpty()) {\n\t\t\t\t\tlogger.warn(\"Package id is missing\");\n\t\t\t\t\tthrow new ClientException(SC_BAD_REQUEST);\n\t\t\t\t}\n\t\t\t\tvar name = pathSegments.get(0);\n\t\t\t\tpathSegments = pathSegments.subList(1, pathSegments.size());\n\t\t\t\tif (pathSegments.isEmpty()) {\n\t\t\t\t\tlogger.warn(\"Package version is missing\");\n\t\t\t\t\tthrow new ClientException(SC_BAD_REQUEST);\n\t\t\t\t}\n\t\t\t\tvar version = pathSegments.get(0);\n\n\t\t\t\tLockUtils.run(getLockName(projectId, name), () -> transactionService.run(() -> {","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-pack-nuget/src/main/java/io/onedev/server/plugin/pack/nuget/NugetPackHandler.java#L309-L345","documentation":"A generic HTTP 400 ClientException thrown by the NuGet publish (PUT) handler when the uploaded request fails validation checks — notably when the package version parsed from the .nupkg is not SemVer v2 compatible (logged as 'Package version is not a SemVer v2 compatible version'), or when an expected part of the push request (e.g. the package payload) is absent so the else branch rejects with a bare 400.","triggerScenarios":"PUT push of a .nupkg whose version string is not SemVer v2 compatible; push request missing the required package body/part so the final else throws new ClientException(SC_BAD_REQUEST) with no message.","commonSituations":"Publishing packages with legacy/nonstandard version strings (leading zeros, invalid prerelease labels) from scripts or older NuGet clients; dotnet nuget push against a wrong endpoint that omits the package part; proxy stripping the multipart/zip body.","solutions":["Repackage the .nupkg with a SemVer v2 compatible version (no leading zeros, valid prerelease format) and push again.","Verify you are pushing to the correct OneDev NuGet endpoint (…/nuget/<project>/index.json based source) so the package payload reaches the handler.","Check the client/proxy is not dropping or truncating the uploaded package body.","Use a current NuGet client (dotnet nuget push or nuget push) that sends the standard resource-based push request."],"exampleFix":"// before (invalid version)\n<version>1.02.0</version>\n// after\n<version>1.2.0</version>\ndotnet pack -p:PackageVersion=1.2.0 && dotnet nuget push *.nupkg -s <onedev-nuget-source>","handlingStrategy":"validation","validationCode":"# Validate version is SemVer v2 before pushing\nVERSION=$(xmllint --xpath '//*[local-name()=\"version\"]/text()' *.nuspec 2>/dev/null)\nif ! echo \"$VERSION\" | grep -Eq '^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$'; then\n  echo \"Version $VERSION is not SemVer v2\"; exit 1;\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use semver-valid versions (no leading zeros, valid prerelease tags).","Push via standard dotnet nuget push / nuget push against the OneDev source.","Confirm the package body is not stripped by proxies."],"tags":["nuget","http-400","semver"],"backgroundTag":"schema-validation-failed","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"}