quarkusio/quarkus · warning · IOException
Request too large
Error message
Request too large
What it means
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.
Source
Thrown at independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxInputStream.java:93
return read(b, 0, b.length);
}
@Override
public int read(final byte[] b, final int off, final int len) throws IOException {
if (closed) {
throw new IOException("Stream is closed");
}
if (vertxResteasyReactiveRequestContext.continueState == VertxResteasyReactiveRequestContext.ContinueState.REQUIRED) {
vertxResteasyReactiveRequestContext.continueState = VertxResteasyReactiveRequestContext.ContinueState.SENT;
vertxResteasyReactiveRequestContext.response.writeContinue();
}
readIntoBuffer();
if (limit > 0 && exchange.request.bytesRead() > limit) {
HttpServerResponse response = exchange.request.response();
if (response.headWritten()) {
//the response has been written, not much we can do
exchange.request.connection().close();
throw new IOException("Request too large");
} else {
response.setStatusCode(HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE.code());
response.headers().add(HttpHeaderNames.CONNECTION, "close");
response.endHandler(new Handler<Void>() {
@Override
public void handle(Void event) {
exchange.request.connection().close();
}
});
response.end();
throw new IOException("Request too large");
}
}
if (finished) {
return -1;
}
if (len == 0) {
return 0;View on GitHub (pinned to e1c734241f)
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
Example fix
// before (application.properties) # default small limit, large uploads fail // after quarkus.http.limits.max-body-size=100M
Defensive patterns
Strategy: validation
Validate before calling
// client-side pre-check against configured limit
long maxBodySize = /* quarkus.http.limits.max-body-size in bytes */ 10485760L;
if (payload.length > maxBodySize) {
throw new IllegalArgumentException("Payload " + payload.length + " exceeds server limit " + maxBodySize);
} Try / catch
try {
return upload(payload);
} catch (IOException e) {
if ("Request too large".equals(e.getMessage()) || e instanceof ServerErrorException && ((ServerErrorException) e).getResponse().getStatus() == 413) {
return chunkAndRetry(payload);
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Stream is closed
- Stream is closed
- Extra steps left over
- Failed to open path tree with root %s
- Failed to read %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/df5a6baba4ea0f16.
Report an issue: GitHub.