{"record":{"id":"23452f9fb32c2434","repo":"quarkusio/quarkus","slug":"request-too-large","errorCode":null,"errorMessage":"Request too large","messagePattern":"Request too large","errorType":"http","errorClass":"IOException","httpStatus":413,"severity":"error","filePath":"extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxInputStream.java","lineNumber":91,"sourceCode":"        return read(b, 0, b.length);\n    }\n\n    @Override\n    public int read(final byte[] b, final int off, final int len) throws IOException {\n        if (closed) {\n            throw new IOException(\"Stream is closed\");\n        }\n        if (continueState == ContinueState.REQUIRED) {\n            continueState = ContinueState.SENT;\n            exchange.request.response().writeContinue();\n        }\n        readIntoBuffer();\n        if (limit > 0 && exchange.request.bytesRead() > limit) {\n            HttpServerResponse response = exchange.request.response();\n            if (response.headWritten()) {\n                //the response has been written, not much we can do\n                exchange.request.connection().close();\n                throw new IOException(\"Request too large\");\n            } else {\n                response.setStatusCode(HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE.code());\n                response.headers().add(HttpHeaderNames.CONNECTION, \"close\");\n                response.endHandler(new Handler<Void>() {\n                    @Override\n                    public void handle(Void event) {\n                        exchange.request.connection().close();\n                    }\n                });\n                response.end();\n                throw new IOException(\"Request too large\");\n            }\n        }\n        if (finished) {\n            return -1;\n        }\n        if (len == 0) {\n            return 0;","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxInputStream.java#L73-L109","documentation":"The request body exceeded quarkus.http.limits.max-body-size while the response headers were already written, so Quarkus cannot send a 413 status; it aborts by closing the underlying connection and throws IOException(\"Request too large\").","triggerScenarios":"Client uploads a body larger than quarkus.http.limits.max-body-size and the application starts reading it only after the response head has been committed (e.g. streaming a partial response before draining the input).","commonSituations":"Large file uploads exceeding the default 10240K limit; limits lowered for an endpoint but another filter/proxy already began the response; streaming download of error details while upload continues.","solutions":["Increase quarkus.http.limits.max-body-size (e.g. quarkus.http.limits.max-body-size=50M) to accommodate legitimate payloads.","Compress or chunk client uploads so each request stays under the limit.","Read/validate the request body BEFORE writing any response bytes, so the server can still answer with HTTP 413 instead of a hard connection close.","If a reverse proxy fronts Quarkus, align its body-size limits (e.g. nginx client_max_body_size) with quarkus.http.limits.max-body-size."],"exampleFix":"// before (application.properties)\n# quarkus.http.limits.max-body-size not set (default 10M)\n// after\nquarkus.http.limits.max-body-size=100M","handlingStrategy":"validation","validationCode":"long max = Long.getLong(\"quarkus.http.limits.max-body-size.bytes\", 10L*1024*1024);\nif (request.getContentLengthLong() > max) {\n    response.sendError(413); return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    in.read(buf);\n} catch (IOException e) {\n    if (\"Request too large\".equals(e.getMessage())) {\n        response.setStatusCode(413); /* and stop processing */\n    } else throw e;\n}","preventionTips":["Set quarkus.http.limits.max-body-size to match real upload sizes","Validate Content-Length before reading","Drain the body before committing the response","Align proxy body-size limits with Quarkus limits"],"tags":["io","upload","limit","vertx-http"],"backgroundTag":"request-entity-too-large","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"}