quarkusio/quarkus · error · RuntimeException
No post data
Error message
No post data
What it means
Thrown by RootResource.posts when the POSTed request body is null. In practice with RESTEasy a missing TEXT_PLAIN body is usually rejected earlier, so this guard triggers when some proxy/injection path delivers a null entity. It is a defensive null-check before authenticating the request via the security context.
Source
Thrown at integration-tests/elytron-resteasy/src/main/java/io/quarkus/it/resteasy/elytron/RootResource.java:35
import io.quarkus.security.Authenticated;
import io.quarkus.security.PermissionChecker;
import io.quarkus.security.PermissionsAllowed;
import io.quarkus.security.identity.SecurityIdentity;
import io.quarkus.vertx.http.runtime.security.HttpSecurityUtils;
@Path("/")
public class RootResource {
@Inject
SecurityIdentity identity;
@Inject
Principal principal;
@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
- Send a non-empty text/plain body (e.g. curl -X POST -H 'Content-Type: text/plain' -d 'data' ...).
- Include valid credentials so authentication succeeds before the principal check.
- If the guard should not be reachable, expect an earlier 4xx from RESTEasy and adjust tests accordingly.
Example fix
// before curl -X POST http://localhost:8080/rest-elytron // after curl -X POST -H 'Content-Type: text/plain' -u user:password -d 'hello' http://localhost:8080/rest-elytron
Defensive patterns
Strategy: validation
Validate before calling
if (payload == null || payload.isEmpty()) {
throw new IllegalArgumentException("POST body must be non-empty text/plain");
} Type guard
boolean hasBody(String s) { return s != null && !s.isEmpty(); } Try / catch
try {
String resp = target.request().post(Entity.text(payload));
} catch (javax.ws.rs.InternalServerErrorException e) {
log.error("POST rejected: missing body or principal issue", e);
} Prevention
- Always send a non-empty body with Content-Type: text/plain.
- Authenticate with valid credentials before posting.
- Check Content-Length is non-zero in HTTP clients.
When it happens
Trigger: POST with no body (empty entity) to the TEXT_PLAIN-consuming endpoint, or a client sending Content-Length: 0.
Common situations: curl -X POST without -d; test clients forgetting to set the body; HTTP client libraries sending an empty payload with Content-Type text/plain.
Related errors
- No producers for required item %s, step builder used: %s
- cycle detection failure report (dynamic CycleBuildException
- Build step '%s' does not produce any build item and thus wil
- Cannot consume/produce interface or abstract class build ite
- Unsupported value type: %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/d0e225265f002ecb.
Report an issue: GitHub.