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

  1. Raise the limit via quarkus.http.limits.max-body-size (e.g. 100M) in application.properties
  2. Reduce the client payload size, or chunk/stream the upload within the limit
  3. 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
  4. 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

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


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/df5a6baba4ea0f16. Report an issue: GitHub.