{"record":{"id":"637bbdc7a0ef7691","repo":"quarkusio/quarkus","slug":"duplicating-multibytehttpdata-is-not-supported","errorCode":null,"errorMessage":"Duplicating MultiByteHttpData is not supported","messagePattern":"Duplicating MultiByteHttpData is not supported","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/MultiByteHttpData.java","lineNumber":251,"sourceCode":"\n    @Override\n    public boolean isInMemory() {\n        return true;\n    }\n\n    @Override\n    public File getFile() {\n        return null;\n    }\n\n    @Override\n    public FileUpload copy() {\n        throw new IllegalStateException(\"Copying MultiByteHttpData is not supported\");\n    }\n\n    @Override\n    public FileUpload duplicate() {\n        throw new IllegalStateException(\"Duplicating MultiByteHttpData is not supported\");\n    }\n\n    @Override\n    public FileUpload retainedDuplicate() {\n        throw new IllegalStateException(\"Duplicating MultiByteHttpData is not supported\");\n    }\n\n    @Override\n    public FileUpload replace(ByteBuf content) {\n        throw new IllegalStateException(\"Replacing MultiByteHttpData is not supported\");\n    }\n\n    @Override\n    public FileUpload retain(int increment) {\n        super.retain(increment);\n        return this;\n    }\n","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/MultiByteHttpData.java#L233-L269","documentation":"duplicate() on MultiByteHttpData is explicitly unimplemented: the class cannot produce a duplicate FileUpload because its content spans multiple ByteBufs and duplication semantics are not supported. It always throws IllegalStateException.","triggerScenarios":"Calling FileUpload.duplicate() on a MultiByteHttpData instance, directly or via Netty code that duplicates HttpData objects.","commonSituations":"Sharing one multipart part across multiple outgoing requests by duplicating it; generic HttpData processing pipelines that clone every part.","solutions":["Do not duplicate; construct a fresh MultiByteHttpData and set it with the original content","Restructure code to reuse the same instance when sending multiple requests","Catch IllegalStateException and rebuild the part from the underlying file/bytes"],"exampleFix":"// before\nFileUpload dup = fileUpload.duplicate();\n// after\nFileUpload dup = new MultiByteHttpData(fileUpload.getName(), fileUpload.getFilename(), fileUpload.getContentType(), fileUpload.getCharset());\ndup.setContent(fileUpload.getByteBuf());","handlingStrategy":"fallback","validationCode":"if (data instanceof MultiByteHttpData) { /* do not call duplicate() */ }","typeGuard":"boolean isDuplicable(InterfaceHttpData d) { return !(d instanceof MultiByteHttpData); }","tryCatchPattern":"try { return upload.duplicate(); } catch (IllegalStateException e) { return newUploadFrom(upload); }","preventionTips":["Do not clone multipart parts; rebuild from source bytes/file","Restructure pipelines to avoid duplicating HttpData","Add unit tests covering any generic HttpData duplication logic"],"tags":["netty","multipart","unsupported-operation","resteasy-reactive"],"backgroundTag":"unsupported-operation","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}