quarkusio/quarkus · error · IllegalStateException
Replacing MultiByteHttpData is not supported
Error message
Replacing MultiByteHttpData is not supported
What it means
replace(ByteBuf) on MultiByteHttpData throws IllegalStateException because replacing the content of a multi-buffer upload part with a single ByteBuf is not supported. It is an interface-required stub that always fails.
Source
Thrown at independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/MultiByteHttpData.java:261
@Override
public FileUpload copy() {
throw new IllegalStateException("Copying MultiByteHttpData is not supported");
}
@Override
public FileUpload duplicate() {
throw new IllegalStateException("Duplicating MultiByteHttpData is not supported");
}
@Override
public FileUpload retainedDuplicate() {
throw new IllegalStateException("Duplicating MultiByteHttpData is not supported");
}
@Override
public FileUpload replace(ByteBuf content) {
throw new IllegalStateException("Replacing MultiByteHttpData is not supported");
}
@Override
public FileUpload retain(int increment) {
super.retain(increment);
return this;
}
@Override
public FileUpload retain() {
super.retain();
return this;
}
@Override
public FileUpload touch() {
touch(null);
return this;View on GitHub (pinned to e1c734241f)
Solutions
- Build a new MultiByteHttpData (or another FileUpload implementation) with the new ByteBuf rather than replacing
- Use single-buffer file data types that support replace if buffer swapping is required
- Modify the part before it becomes a MultiByteHttpData (e.g. at the file/attribute stage)
Example fix
// before FileUpload replaced = fileUpload.replace(newContent); // after FileUpload replaced = new MultiByteHttpData(fileUpload.getName(), fileUpload.getFilename(), fileUpload.getContentType(), fileUpload.getCharset()); replaced.setContent(newContent);
Defensive patterns
Strategy: fallback
Validate before calling
if (data instanceof MultiByteHttpData) { /* avoid replace() */ } Type guard
boolean supportsReplace(InterfaceHttpData d) { return !(d instanceof MultiByteHttpData); } Try / catch
try { return upload.replace(buf); } catch (IllegalStateException e) { return newUploadWith(buf); } Prevention
- Create a new FileUpload instance when content must change
- Transform content before constructing the multipart part
- Prefer immutable handling of multipart parts in filters
When it happens
Trigger: Calling FileUpload.replace(ByteBuf) on a MultiByteHttpData instance, e.g. when rewriting part content before send.
Common situations: Transforming multipart content in client filters; code that swaps buffers on Netty HttpData objects assuming all implementations support replace.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- setting content of MultiByteHttpData is not supported
- adding content to MultiByteHttpData is not supported
- getting all the contents of a MultiByteHttpData is not suppo
- Reading MultiByteHttpData as String is not supported
- Renaming destination file for MultiByteHttpData is not suppo
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/1fe53b583c61d1b8.
Report an issue: GitHub.