{"record":{"id":"1019de8309d040ac","repo":"quarkusio/quarkus","slug":"unable-to-provide-file-for-download","errorCode":null,"errorMessage":"Unable to provide file for download","messagePattern":"Unable to provide file for download","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/FileDownloadImpl.java","lineNumber":29,"sourceCode":"\n    // we're using netty's file upload to represent download too\n    private final FileUpload file;\n\n    public FileDownloadImpl(FileUpload httpData) {\n        this.file = httpData;\n    }\n\n    @Override\n    public String name() {\n        return file.getName();\n    }\n\n    @Override\n    public Path filePath() {\n        try {\n            return file == null ? null : file.getFile().toPath();\n        } catch (IOException e) {\n            throw new IllegalArgumentException(\"Unable to provide file for download\", e);\n        }\n    }\n\n    @Override\n    public String fileName() {\n        return file.getFilename();\n    }\n\n    @Override\n    public long size() {\n        throw new UnsupportedOperationException(\"returning size of a downloaded file is not supported\");\n    }\n\n    @Override\n    public String contentType() {\n        return file.getContentType();\n    }\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/FileDownloadImpl.java#L11-L47","documentation":"FileDownloadImpl.filePath() wraps IOException in this IllegalArgumentException when it cannot materialize the downloaded multipart file on disk to return a Path. The download itself succeeded into a temp file, but reading/converting the underlying FileUpload to a java.nio.file.Path failed due to filesystem I/O problems.","triggerScenarios":"Calling filePath() on a MultipartFormDataDownload/FileDownload when the backing temp file has been deleted, disk is full, permissions deny access, or the file was moved before filePath() was invoked.","commonSituations":"Temp directories cleaned up aggressively (systemd-tmpfiles, containers with tmpfs), read-only or full disks, concurrent requests where response files are accessed after cleanup, long-lived references to downloads whose temp files expired.","solutions":["Call filePath() promptly after receiving the response, before temp cleanup","Copy/move the file to persistent storage immediately and work from the copy","Check disk space and permissions on the temp directory (java.io.tmpdir)","Inspect the wrapped IOException cause for the real filesystem error"],"exampleFix":"// before\nPath p = download.filePath(); // may throw IllegalArgumentException on I/O failure\n// after\nPath p;\ntry {\n    p = download.filePath();\n    Files.move(p, persistentPath, StandardCopyOption.REPLACE_EXISTING);\n} catch (IllegalArgumentException | IOException e) {\n    throw new IOException(\"Failed to persist downloaded file\", e);\n}","handlingStrategy":"try-catch","validationCode":"Path tmpDir = Path.of(System.getProperty(\"java.io.tmpdir\"));\nif (!Files.isWritable(tmpDir)) throw new IllegalStateException(\"Temp dir not writable\");","typeGuard":null,"tryCatchPattern":"try {\n    Path p = download.filePath();\n    Files.copy(p, dest, StandardCopyOption.REPLACE_EXISTING);\n} catch (IllegalArgumentException e) {\n    throw new IOException(\"Downloaded file unavailable on disk: \" + e.getCause(), e);\n}","preventionTips":["Consume downloads immediately; do not retain FileDownload across long delays","Monitor disk space and tmp cleaner settings in the deployment environment","Always inspect getCause() (the IOException) for the real filesystem problem","Move files out of the temp dir into persistent storage right after the response"],"tags":["rest-client","multipart","file-download","ioexception"],"backgroundTag":"file-io-failed","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"}