quarkusio/quarkus · error · RuntimeException

No post data

Error message

No post data

What it means

Sentinel RuntimeException thrown by RootResource.posts() in the elytón-resteasy-reactive integration test. It fires when the @POST endpoint receives a null body even though it declares @Consumes(TEXT_PLAIN). It is the test's way of failing fast when request payload propagation to a JAX-RS method parameter breaks.

Source

Thrown at integration-tests/elytron-resteasy-reactive/src/main/java/io/quarkus/it/resteasy/reactive/elytron/RootResource.java:30

import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.SecurityContext;

import io.quarkus.security.Authenticated;
import io.quarkus.security.PermissionsAllowed;
import io.quarkus.security.identity.SecurityIdentity;

@Path("/")
public class RootResource {
    @Inject
    SecurityIdentity identity;

    @POST
    @Consumes(MediaType.TEXT_PLAIN)
    public String posts(String data, @Context SecurityContext sec) {
        if (data == null) {
            throw new RuntimeException("No post data");
        }
        if (sec.getUserPrincipal().getName() == null) {
            throw new RuntimeException("Failed to get user principal");
        }
        return "post success";
    }

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String approval(@Context SecurityContext sec) {
        if (sec.getUserPrincipal().getName() == null) {
            throw new RuntimeException("Failed to get user principal");
        }
        return "get success";
    }

    @GET
    @Path("/secure")

View on GitHub (pinned to e1c734241f)

Solutions

  1. Send a non-empty plain-text body with Content-Type: text/plain
  2. Ensure the client sends the payload as the request entity (e.g. curl -d 'data'), not as a query param
  3. Verify the endpoint method signature binds the body to the first String parameter
  4. Check no filter/interceptor consumes or clears the request entity stream

Example fix

// before
curl -X POST http://localhost:8080/api -H 'Content-Type: text/plain'
// after
curl -X POST http://localhost:8080/api -H 'Content-Type: text/plain' -d 'hello'
Defensive patterns

Strategy: validation

Validate before calling

if (data == null || data.isBlank()) {
    throw new BadRequestException("Request body must be non-empty text/plain");
}

Type guard

boolean hasBody(String data) {
    return data != null && !data.isBlank();
}

Try / catch

try {
    process(data);
} catch (RuntimeException e) {
    throw new BadRequestException("Missing or unreadable POST body", e);
}

Prevention

When it happens

Trigger: POST with @Consumes(TEXT_PLAIN) where the request body arrives as null — empty body, missing Content-Type matching TEXT_PLAIN, or content that the reader fails to decode into the String parameter.

Common situations: Test/client sending POST without a body; wrong Content-Type header (e.g. application/json) so no text body is bound; proxy or client stripping the payload.

Related errors


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