{"record":{"id":"c1a13280b6cb9744","repo":"quarkusio/quarkus","slug":"setting-content-of-multibytehttpdata-is-not-suppor","errorCode":null,"errorMessage":"setting content of MultiByteHttpData is not supported","messagePattern":"setting content of 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":142,"sourceCode":"                    errorHandler.accept(th);\n                },\n                () -> {\n                    done = true;\n                    if (paused) {\n                        paused = false;\n                        resumption.run();\n                    }\n                });\n    }\n\n    void suspend(int awaitedBytes) {\n        this.awaitedBytes = awaitedBytes;\n        this.paused = true;\n    }\n\n    @Override\n    public void setContent(ByteBuf buffer) throws IOException {\n        throw new IllegalStateException(\"setting content of MultiByteHttpData is not supported\");\n    }\n\n    @Override\n    public void addContent(ByteBuf buffer, boolean last) throws IOException {\n        throw new IllegalStateException(\"adding content to MultiByteHttpData is not supported\");\n    }\n\n    @Override\n    public void setContent(File file) throws IOException {\n        throw new IllegalStateException(\"setting content of MultiByteHttpData is not supported\");\n    }\n\n    @Override\n    public void setContent(InputStream inputStream) throws IOException {\n        throw new IllegalStateException(\"setting content of MultiByteHttpData is not supported\");\n    }\n\n    @Override","sourceCodeStart":124,"sourceCodeEnd":160,"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#L124-L160","documentation":"MultiByteHttpData is an internal Netty FileUpload adapter that streams a Multi<Byte> as a multipart file part; its content is fed exclusively by the reactive subscription created in the constructor. setContent(ByteBuf) is one of several InterfaceHttpData lifecycle methods the class deliberately rejects with IllegalStateException because content must only arrive via the Multi pipeline.","triggerScenarios":"Calling setContent(ByteBuf) on a MultiByteHttpData instance, typically from generic Netty HttpPostRequestEncoder/decoder code or custom multipart handling code that treats it like a normal FileUpload.","commonSituations":"Writing custom multipart encoding logic against Netty's InterfaceHttpData API; reusing a request's multipart parts across encoder implementations; code migrated from standard Netty FileUpload to the RESTEasy Reactive streaming variant.","solutions":["Do not call setContent on MultiByteHttpData; supply the body as a Multi<Byte> when building the multipart part (QuarkusRestClient multipart API).","If you hold an InterfaceHttpData reference, check its concrete type before mutating and only call setContent on standard MemoryFileUpload/DiskFileUpload instances.","If you need a fully materialized upload, use a File/Path or byte[]-based multipart part instead of the streaming Multi variant.","Update custom encoders (e.g. PausableHttpPostRequestEncoder integrations) to feed data through addContent-free streaming API rather than direct content mutation."],"exampleFix":"// before\nfileUpload.setContent(Unpooled.wrappedBuffer(bytes));\n// after\nMultipartFormItem item = MultipartFormItem.builder()\n        .fieldName(\"file\")\n        .streamBody(Multi.createFrom().items(bytes)); // content flows via the Multi, never setContent","handlingStrategy":"validation","validationCode":"if (data instanceof MultiByteHttpData) {\n    throw new IllegalArgumentException(\"MultiByteHttpData is streaming-only; supply content via Multi<Byte>, not setContent()\");\n}\ndata.setContent(buf);","typeGuard":"boolean supportsSetContent(InterfaceHttpData data) {\n    return !(data instanceof MultiByteHttpData);\n}","tryCatchPattern":"try {\n    data.setContent(buf);\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"not supported\")) {\n        // rebuild the part with Multi<Byte> content instead of mutating it\n    } else {\n        throw e;\n    }\n}","preventionTips":["Feed multipart streaming parts exclusively through the client's Multi<Byte> API.","Never reuse or mutate a MultiByteHttpData after construction.","Type-check InterfaceHttpData instances before calling mutation methods.","Prefer byte[]/File parts when you don't need reactive streaming."],"tags":["multipart","unsupported-operation","resteasy-reactive","netty"],"backgroundTag":"unsupported-multipart-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"}