{"record":{"id":"82fd4de9d8faffd5","repo":"quarkusio/quarkus","slug":"quarkus-rest-client-multipart-buffer-size-cannot-b","errorCode":null,"errorMessage":"quarkus.rest.client.multipart-buffer-size cannot be lower than 16384","messagePattern":"quarkus\\.rest\\.client\\.multipart-buffer-size cannot be lower than 16384","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/MultiByteHttpData.java","lineNumber":81,"sourceCode":"\n    private String contentTransferEncoding;\n\n    // TODO: replace with a simple array based?\n    // TODO: we do `discardReadBytes` on it which is not optimal - copies array every time\n    private final ByteBuf buffer = VertxByteBufAllocator.DEFAULT.heapBuffer(BUFFER_SIZE, BUFFER_SIZE);\n\n    private final Context context;\n\n    private volatile boolean done = false;\n\n    private boolean paused = false;\n    private int awaitedBytes;\n\n    static {\n        BUFFER_SIZE = Integer\n                .parseInt(System.getProperty(\"quarkus.rest.client.multipart-buffer-size\", String.valueOf(DEFAULT_BUFFER_SIZE)));\n        if (BUFFER_SIZE < DEFAULT_BUFFER_SIZE) {\n            throw new IllegalStateException(\n                    \"quarkus.rest.client.multipart-buffer-size cannot be lower than \" + DEFAULT_BUFFER_SIZE);\n        }\n    }\n\n    /**\n     *\n     * @param name name of the parameter\n     * @param filename file name\n     * @param contentType content type\n     * @param contentTransferEncoding \"binary\" for sending binary files\n     * @param charset the charset\n     * @param content the Multi to send\n     * @param errorHandler error handler invoked when the Multi emits an exception\n     * @param context Vertx context on which the data is sent\n     * @param resumption the action to execute when the requested amount of bytes is ready, or the Multi is completed\n     */\n    public MultiByteHttpData(String name, String filename, String contentType,\n            String contentTransferEncoding, Charset charset, Multi<Byte> content,","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/MultiByteHttpData.java#L63-L99","documentation":"This IllegalStateException is thrown in MultiByteHttpData's static initializer when the system property quarkus.rest.client.multipart-buffer-size is set below the default minimum of 16384 bytes. The multipart encoder requires a minimum buffer size to function correctly, so an invalid value fails the class load immediately at first use.","triggerScenarios":"Starting an application with -Dquarkus.rest.client.multipart-buffer-size=<value less than 16384>; the static block in MultiByteHttpData validates the parsed value and throws during class initialization.","commonSituations":"Tuning multipart uploads downward to save memory without knowing the floor, copying a property value from a different setting that uses a smaller default, typos producing tiny values, container images baking in an invalid JVM property.","solutions":["Set quarkus.rest.client.multipart-buffer-size to 16384 or higher","Remove the system property entirely to fall back to the default buffer size","If memory is the goal, tune other limits (e.g. multipart max size) rather than shrinking this buffer"],"exampleFix":"// before\njava -Dquarkus.rest.client.multipart-buffer-size=4096 -jar app.jar\n// after\njava -Dquarkus.rest.client.multipart-buffer-size=16384 -jar app.jar","handlingStrategy":"validation","validationCode":"int v = Integer.parseInt(System.getProperty(\"quarkus.rest.client.multipart-buffer-size\", \"16384\"));\nif (v < 16384) throw new IllegalStateException(\"quarkus.rest.client.multipart-buffer-size must be >= 16384\");","typeGuard":null,"tryCatchPattern":"try {\n    // first multipart request triggers class init\n    sendMultipartRequest();\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"multipart-buffer-size\")) {\n        throw new IllegalStateException(\"Fix JVM property quarkus.rest.client.multipart-buffer-size (must be >= 16384)\", e);\n    }\n    throw e;\n}","preventionTips":["Never set quarkus.rest.client.multipart-buffer-size below 16384","Validate JVM flags in startup scripts/container entrypoints","Remove the property entirely if you only need the default behavior","Add a smoke multipart request to startup health checks to catch config errors early"],"tags":["rest-client","multipart","configuration","buffer-size","illegal-state"],"backgroundTag":"invalid-config-value","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"}