quarkusio/quarkus · error · NoContentException

Input was empty

Error message

Input was empty

What it means

ClientDefaultTextPlainBodyHandler handles @Consumes("text/plain") responses in the REST Easy Reactive client. It overrides validateInput to reject empty string bodies, throwing a ProcessingException wrapping a NoContentException with the message 'Input was empty'. The parent DefaultTextPlainBodyHandler tolerates empty input, but this client-side subclass treats a 200/2xx response with an empty body as an error because text/plain entities are expected to be non-empty.

Source

Thrown at independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/providers/serialisers/ClientDefaultTextPlainBodyHandler.java:17

package org.jboss.resteasy.reactive.client.providers.serialisers;

import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.ProcessingException;
import jakarta.ws.rs.core.NoContentException;
import jakarta.ws.rs.ext.Provider;

import org.jboss.resteasy.reactive.common.providers.serialisers.DefaultTextPlainBodyHandler;

@Provider
@Consumes("text/plain")
public class ClientDefaultTextPlainBodyHandler extends DefaultTextPlainBodyHandler {

    @Override
    protected void validateInput(String input) throws ProcessingException {
        if (input.isEmpty()) {
            throw new ProcessingException(new NoContentException("Input was empty"));
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Fix the server to return a non-empty body or a proper media type (e.g. application/json, or 204 No Content instead of 200 with empty text/plain)
  2. On the client, declare the expected return type as Response or Void so the text/plain body handler is bypassed
  3. Catch ProcessingException with cause NoContentException in client code and treat it as 'no data'
  4. Align @Produces on the server resource with what the client expects

Example fix

// before: client explodes on empty text/plain body
String result = client.getValue(); // ProcessingException: Input was empty
// after: tolerate empty responses via Response
Response response = client.getValueResponse();
String result = response.hasEntity() ? response.readEntity(String.class) : null;
Defensive patterns

Strategy: try-catch

Validate before calling

Response r = client.get();
if (r.getStatus() == 204 || !r.hasEntity()) { /* treat as no content */ }

Try / catch

try {
    String body = client.getText();
} catch (ProcessingException e) {
    if (e.getCause() instanceof NoContentException) {
        body = null; // empty body is acceptable
    } else throw e;
}

Prevention

When it happens

Trigger: A client method whose response media type is text/plain receives a 2xx response with a zero-length body; ClientEntityProviders then invokes the text/plain body handler, whose validateInput("" ) throws.

Common situations: Server endpoint returns void/empty string with text/plain content type; proxy/redirect stripping the body; misconfigured @Produces on the server (text/plain instead of application/json) yielding empty payload; DELETE/POST endpoints returning empty success responses.

Related errors


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