{"record":{"id":"df5a6baba4ea0f16","repo":"quarkusio/quarkus","slug":"request-too-large-df5a6b","errorCode":null,"errorMessage":"Request too large","messagePattern":"Request too large","errorType":"http","errorClass":"IOException","httpStatus":413,"severity":"warning","filePath":"independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxInputStream.java","lineNumber":93,"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 (vertxResteasyReactiveRequestContext.continueState == VertxResteasyReactiveRequestContext.ContinueState.REQUIRED) {\n            vertxResteasyReactiveRequestContext.continueState = VertxResteasyReactiveRequestContext.ContinueState.SENT;\n            vertxResteasyReactiveRequestContext.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":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxInputStream.java#L75-L111","documentation":"VertxInputStream enforces a configured request size limit while reading the body. When the bytes read exceed the limit, it throws IOException(\"Request too large\"). If the response has not started it sends HTTP 413 REQUEST_ENTITY_TOO_LARGE; if headers were already written it can only close the connection, hence the IOException.","triggerScenarios":"Uploading/sending a request body larger than the configured limit (quarkus.http.limits.max-body-size) while reading via read() on VertxInputStream; reading a large upload after the response head was written triggers the IOException branch.","commonSituations":"Large file uploads rejected with 413; multipart uploads exceeding max-body-size; clients uploading payloads bigger than the default body limit; proxied requests forwarding large bodies.","solutions":["Raise the limit via quarkus.http.limits.max-body-size (e.g. 100M) in application.properties","Reduce the client payload size, or chunk/stream the upload within the limit","Avoid writing the response head before fully reading/validating the body, so the 413 status can be returned properly instead of a hard connection close","If streaming uploads are required, configure an appropriate limit for the upload route"],"exampleFix":"// before (application.properties)\n# default small limit, large uploads fail\n\n// after\nquarkus.http.limits.max-body-size=100M","handlingStrategy":"validation","validationCode":"// client-side pre-check against configured limit\nlong maxBodySize = /* quarkus.http.limits.max-body-size in bytes */ 10485760L;\nif (payload.length > maxBodySize) {\n    throw new IllegalArgumentException(\"Payload \" + payload.length + \" exceeds server limit \" + maxBodySize);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return upload(payload);\n} catch (IOException e) {\n    if (\"Request too large\".equals(e.getMessage()) || e instanceof ServerErrorException && ((ServerErrorException) e).getResponse().getStatus() == 413) {\n        return chunkAndRetry(payload);\n    }\n    throw e;\n}","preventionTips":["Set quarkus.http.limits.max-body-size to accommodate expected uploads","Check Content-Length client-side before sending large payloads","Keep server-side validation before writing any response head so 413 can be returned cleanly","For large files, stream/chunk uploads within the limit"],"tags":["http-413","request-body","upload-limit","io"],"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"}