quarkusio/quarkus · error · IllegalStateException
Duplicating MultiByteHttpData is not supported
Error message
Duplicating MultiByteHttpData is not supported
What it means
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.
Source
Thrown at independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/MultiByteHttpData.java:251
@Override
public boolean isInMemory() {
return true;
}
@Override
public File getFile() {
return null;
}
@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;
}
View on GitHub (pinned to e1c734241f)
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
Example fix
// before FileUpload dup = fileUpload.duplicate(); // after FileUpload dup = new MultiByteHttpData(fileUpload.getName(), fileUpload.getFilename(), fileUpload.getContentType(), fileUpload.getCharset()); dup.setContent(fileUpload.getByteBuf());
Defensive patterns
Strategy: fallback
Validate before calling
if (data instanceof MultiByteHttpData) { /* do not call duplicate() */ } Type guard
boolean isDuplicable(InterfaceHttpData d) { return !(d instanceof MultiByteHttpData); } Try / catch
try { return upload.duplicate(); } catch (IllegalStateException e) { return newUploadFrom(upload); } Prevention
- 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
When it happens
Trigger: Calling FileUpload.duplicate() on a MultiByteHttpData instance, directly or via Netty code that duplicates HttpData objects.
Common situations: Sharing one multipart part across multiple outgoing requests by duplicating it; generic HttpData processing pipelines that clone every part.
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/637bbdc7a0ef7691.
Report an issue: GitHub.