{"record":{"id":"9b80af4575196bbe","repo":"theonedev/onedev","slug":"internal-error-9b80af","errorCode":null,"errorMessage":"internal error","messagePattern":"internal error","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"server-plugin/server-plugin-pack-pypi/src/main/java/io/onedev/server/plugin/pack/pypi/PypiPackHandler.java","lineNumber":188,"sourceCode":"\t\t\t\t\t\t\t\t\tif (data.getSha256BlobHashes().containsKey(fileName)) {\n\t\t\t\t\t\t\t\t\t\tvar errorMessage = String.format(\"Package already exists (name: %s, version: %s)\", name, version);\n\t\t\t\t\t\t\t\t\t\tthrow new ClientException(SC_CONFLICT, errorMessage);\n\t\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t\t\tdata.getSha256BlobHashes().put(fileName, sha256Hash);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tvar packBlobs = data.getSha256BlobHashes().values().stream()\n\t\t\t\t\t\t\t\t\t\t\t.map(hash -> packBlobService.findBySha256Hash(projectId, hash))\n\t\t\t\t\t\t\t\t\t\t\t.filter(Objects::nonNull)\n\t\t\t\t\t\t\t\t\t\t\t.collect(toList());\n\t\t\t\t\t\t\t\t\tpackService.createOrUpdate(pack, packBlobs, data.getSha256BlobHashes().size() == 1);\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t\tresponse.setStatus(SC_OK);\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} catch (IOException | FileUploadException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new ClientException(SC_METHOD_NOT_ALLOWED);\n\t\t\t}\n\t\t} else {\n\t\t\tif (!isGet)\n\t\t\t\tthrow new ClientException(SC_METHOD_NOT_ALLOWED);\n\t\t\tvar currentSegment = pathSegments.get(0);\n\t\t\tpathSegments = pathSegments.subList(1, pathSegments.size());\n\t\t\t\n\t\t\t// https://peps.python.org/pep-0503/\n\t\t\tif (currentSegment.equals(\"simple\")) { \n\t\t\t\tif (pathSegments.isEmpty()) {\n\t\t\t\t\tsessionService.run(() -> {\n\t\t\t\t\t\tvar project = checkProject(projectId, false);\n\t\t\t\t\t\tvar names = packService.queryNames(project, TYPE, null, true, 0, MAX_VALUE);\n\t\t\t\t\t\tvar bindings = new HashMap<String, Object>();\n\t\t\t\t\t\tbindings.put(\"names\", names);","sourceCodeStart":170,"sourceCodeEnd":206,"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#L170-L206","documentation":"During a PyPI package upload (POST multipart) handled by PypiPackHandler.handle, an IOException or FileUploadException occurred while parsing the multipart form upload. The handler wraps it in a plain RuntimeException, which OneDev surfaces to the client as a generic 'internal error'. It indicates the upload request body could not be read or parsed as multipart.","triggerScenarios":"POSTing a package file to the ~pypi upload endpoint with a malformed multipart body, a truncated/interrupted upload, missing or malformed content-disposition part, or an invalid multipart boundary; the catch block at PypiPackHandler.java:187-188 converts the underlying IOException/FileUploadException into RuntimeException.","commonSituations":"twine upload interrupted by network drop; a proxy (nginx, corporate proxy) truncating or buffering the request body; client sending a non-multipart body or wrong Content-Type header; disk I/O problems on the server while spooling the upload.","solutions":["Check server logs for the root IOException/FileUploadException stack trace below the 'internal error' to identify the real cause","Retry the twine upload and verify the multipart Content-Type and boundary are preserved end-to-end","Inspect proxy/load-balancer settings for request body size limits and timeouts that could truncate the upload","Verify sufficient disk space and writable temp directory on the OneDev server for multipart spooling","Upgrade the client (twine) if it sends a non-standard multipart encoding"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// client side: verify multipart body before upload\nconst contentType = respHeaders['content-type'] || '';\nif (!contentType.includes('multipart/form-data')) throw new Error('Upload must be multipart/form-data');\nif (!fs.existsSync(pkgFile)) throw new Error('Package file not found: ' + pkgFile);","typeGuard":null,"tryCatchPattern":"try {\n  await twine.upload(repoUrl, pkgFile);\n} catch (e) {\n  if (e.response && /internal error/.test(e.message)) {\n    console.error('Upload failed server-side; check OneDev server logs for wrapped IOException/FileUploadException', e);\n  } else { throw e; }\n}","preventionTips":["Always upload with twine or a client that produces standard multipart/form-data","Check proxy body-size limits and timeouts before pushing large wheels","Monitor server disk space for multipart spooling","Retry transient network failures with backoff"],"tags":["http","upload","multipart","io"],"backgroundTag":"http-request-failed","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"}