quarkusio/quarkus · error · UnsupportedOperationException
returning size of a downloaded file is not supported
Error message
returning size of a downloaded file is not supported
What it means
FileDownloadImpl.size() unconditionally throws UnsupportedOperationException because the REST Easy Reactive client multipart download does not track the size of the downloaded file. The underlying FileUpload abstraction it wraps does not expose a reliable size, so the API surface exists for interface compatibility but is explicitly unsupported.
Source
Thrown at independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/FileDownloadImpl.java:40
}
@Override
public Path filePath() {
try {
return file == null ? null : file.getFile().toPath();
} catch (IOException e) {
throw new IllegalArgumentException("Unable to provide file for download", e);
}
}
@Override
public String fileName() {
return file.getFilename();
}
@Override
public long size() {
throw new UnsupportedOperationException("returning size of a downloaded file is not supported");
}
@Override
public String contentType() {
return file.getContentType();
}
@Override
public String charSet() {
return file.getCharset().name();
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Determine size by calling Files.size(download.filePath()) after obtaining the Path
- Read the Content-Length header from the response instead of the download object
- Avoid size() entirely; stream the file and count bytes if needed
Example fix
// before long len = download.size(); // always throws // after long len = Files.size(download.filePath()); // or use the response Content-Length header
Defensive patterns
Strategy: fallback
Try / catch
long size;
try {
size = download.size();
} catch (UnsupportedOperationException e) {
size = Files.size(download.filePath()); // fallback
} Prevention
- Never call size() on FileDownload in REST Easy Reactive; use Files.size(filePath())
- Read Content-Length from the response headers when size is needed before consuming
- Document this limitation when porting code from other HTTP clients
When it happens
Trigger: Any call to size() on a FileDownload obtained from a multipart file download response — there are no conditions; it always throws.
Common situations: Porting code from other clients (e.g. RestEasy Classic or WebClient) that exposed download size, computing progress bars or disk space checks before writing, generic file-handling utilities that call size() on any FileDownload implementation.
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
- Unable to provide file for download
- Specifying executor service is not supported. The underlying
- AnnotationTransformation is not an AnnotationsTransformer: "
- PartType annotation is only supported on fields and (setter/
- Primitive types are not supported for multipart response map
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/ceb38638517f9b5e.
Report an issue: GitHub.