{"record":{"id":"d13463018e78ef7d","repo":"quarkusio/quarkus","slug":"copying-multibytehttpdata-is-not-supported","errorCode":null,"errorMessage":"Copying MultiByteHttpData is not supported","messagePattern":"Copying 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":246,"sourceCode":"\n    @Override\n    public boolean renameTo(File dest) {\n        throw new IllegalStateException(\"Renaming destination file for MultiByteHttpData is not supported\");\n    }\n\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","sourceCodeStart":228,"sourceCodeEnd":264,"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#L228-L264","documentation":"MultiByteHttpData represents multipart file-upload data buffered across multiple Netty ByteBufs in the RESTEasy Reactive client. The copy() method is part of the Netty InterfaceHttpData/FileUpload contract but is intentionally unimplemented here because copying multi-buffer content is not supported. Calling it always throws IllegalStateException.","triggerScenarios":"Calling FileUpload.copy() on a MultiByteHttpData instance, typically indirectly via framework code that clones HttpData objects while building or transforming a multipart request.","commonSituations":"Middleware or interceptors that duplicate file upload parts before sending; code ported from classic Netty HttpPostRequestEncoder usage that assumes copy() works on all FileUpload implementations.","solutions":["Avoid copying MultiByteHttpData; reuse the same instance or create a new one with the same content","Wrap the copy call and fall back to re-reading the source file/part into a new MultiByteHttpData","Use duplicate()/retainedDuplicate() alternatives only if you handle their own unsupported exceptions"],"exampleFix":"// before\nFileUpload copy = fileUpload.copy();\n// after\nFileUpload copy = new MultiByteHttpData(name, filename, contentType, charset);\ncopy.setContent(fileUpload.getByteBuf());","handlingStrategy":"fallback","validationCode":"if (data instanceof MultiByteHttpData) { /* do not call copy() */ }","typeGuard":"boolean isCopyable(InterfaceHttpData d) { return !(d instanceof MultiByteHttpData); }","tryCatchPattern":"try { return upload.copy(); } catch (IllegalStateException e) { return rebuildUpload(upload); }","preventionTips":["Check the concrete FileUpload type before cloning operations","Reuse instances instead of copying multipart parts","Read the class docs for unsupported interface methods"],"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-14T00:17:10.932Z"}