{"record":{"id":"ca2283ad183f93c4","repo":"quarkusio/quarkus","slug":"input-was-empty","errorCode":null,"errorMessage":"Input was empty","messagePattern":"Input was empty","errorType":"exception","errorClass":"NoContentException","httpStatus":204,"severity":"error","filePath":"independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/providers/serialisers/ClientDefaultTextPlainBodyHandler.java","lineNumber":17,"sourceCode":"package org.jboss.resteasy.reactive.client.providers.serialisers;\n\nimport jakarta.ws.rs.Consumes;\nimport jakarta.ws.rs.ProcessingException;\nimport jakarta.ws.rs.core.NoContentException;\nimport jakarta.ws.rs.ext.Provider;\n\nimport org.jboss.resteasy.reactive.common.providers.serialisers.DefaultTextPlainBodyHandler;\n\n@Provider\n@Consumes(\"text/plain\")\npublic class ClientDefaultTextPlainBodyHandler extends DefaultTextPlainBodyHandler {\n\n    @Override\n    protected void validateInput(String input) throws ProcessingException {\n        if (input.isEmpty()) {\n            throw new ProcessingException(new NoContentException(\"Input was empty\"));\n        }\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/providers/serialisers/ClientDefaultTextPlainBodyHandler.java#L1-L21","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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)","On the client, declare the expected return type as Response or Void so the text/plain body handler is bypassed","Catch ProcessingException with cause NoContentException in client code and treat it as 'no data'","Align @Produces on the server resource with what the client expects"],"exampleFix":"// before: client explodes on empty text/plain body\nString result = client.getValue(); // ProcessingException: Input was empty\n// after: tolerate empty responses via Response\nResponse response = client.getValueResponse();\nString result = response.hasEntity() ? response.readEntity(String.class) : null;","handlingStrategy":"try-catch","validationCode":"Response r = client.get();\nif (r.getStatus() == 204 || !r.hasEntity()) { /* treat as no content */ }","typeGuard":null,"tryCatchPattern":"try {\n    String body = client.getText();\n} catch (ProcessingException e) {\n    if (e.getCause() instanceof NoContentException) {\n        body = null; // empty body is acceptable\n    } else throw e;\n}","preventionTips":["Return 204 instead of 200 with an empty text/plain body","Keep server @Produces aligned with actual payload media type","Read into Response when empty bodies are possible","Add tests covering empty response bodies"],"tags":["resteasy-reactive-client","body-handler","text-plain","empty-body"],"backgroundTag":"empty-response-body","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}