quarkusio/quarkus · error · IllegalStateException
Renaming destination file for MultiByteHttpData is not suppo
Error message
Renaming destination file for MultiByteHttpData is not supported
What it means
renameTo(File) moves a disk-backed Netty HttpData's file to a destination. MultiByteHttpData never touches the filesystem - it streams bytes from a Multi<Byte> entirely in memory buffers - so there is no file to rename and 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:231
toRead -= readBytes;
}
return result;
}
@Override
public String getString() {
throw new IllegalStateException("Reading MultiByteHttpData as String is not supported");
}
@Override
public String getString(Charset encoding) {
throw new IllegalStateException("Reading MultiByteHttpData as String is not supported");
}
@Override
public boolean renameTo(File dest) {
throw new IllegalStateException("Renaming destination file for MultiByteHttpData is not supported");
}
@Override
public boolean isInMemory() {
return true;
}
@Override
public File getFile() {
return null;
}
@Override
public FileUpload copy() {
throw new IllegalStateException("Copying MultiByteHttpData is not supported");
}
@OverrideView on GitHub (pinned to e1c734241f)
Solutions
- If you need the content as a file, drain it with getChunk(int) (after isReady) and write the chunks to the destination file yourself.
- Use a File/Path-based multipart part when you need file semantics (renameTo, getFile).
- Never call renameTo on client-side streaming parts; treat it as an unsupported operation by contract.
- Branch on the concrete InterfaceHttpData type before calling renameTo.
Example fix
// before
httpData.renameTo(new File("/tmp/out.bin"));
// after
try (FileOutputStream out = new FileOutputStream("/tmp/out.bin")) {
while (httpData.isReady(chunkSize)) {
ByteBuf chunk = httpData.getChunk(chunkSize);
out.write(chunk.array(), chunk.arrayOffset(), chunk.readableBytes());
}
} Defensive patterns
Strategy: type-guard
Validate before calling
void safeRenameTo(InterfaceHttpData data, File dest) throws IOException {
if (data instanceof MultiByteHttpData) {
throw new IllegalArgumentException("Streaming parts have no backing file; drain via getChunk() to a file");
}
data.renameTo(dest);
} Type guard
boolean hasBackingFile(InterfaceHttpData data) {
return !(data instanceof MultiByteHttpData) && data.getFile() != null;
} Try / catch
try {
data.renameTo(dest);
} catch (IllegalStateException e) {
if (e.getMessage() != null && e.getMessage().contains("not supported")) {
// write chunks from getChunk() to dest manually
} else {
throw e;
}
} Prevention
- Remember isInMemory()==true does not imply file support.
- Use File/Path parts when file operations (renameTo/getFile) are needed.
- Drain streaming parts with isReady/getChunk to persist them.
- Type-check before rename operations.
When it happens
Trigger: Calling renameTo(File) on a MultiByteHttpData, e.g. code that persists received/generated file uploads generically by renaming their backing files.
Common situations: Server-side upload-handling patterns (rename temp file to final location) reused against client multipart parts; cleanup/persistence utilities iterating InterfaceHttpData objects; code assuming isInMemory()==true implies file support.
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
- Copying MultiByteHttpData is not supported
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/6f3a742e3456ea95.
Report an issue: GitHub.