quarkusio/quarkus · info · RuntimeException
bad input
Error message
bad input
What it means
Same contract as 3886 but in the RESTEasy Reactive variant of the amazon-lambda-http test: POST /hello with application/octet-stream requires the first four bytes to be exactly 0,1,2,3, otherwise RuntimeException("bad input") is thrown. It validates binary bodies through API Gateway with RESTEasy Reactive.
Source
Thrown at integration-tests/amazon-lambda-http-resteasy-reactive/src/main/java/io/quarkus/it/amazon/lambda/GreetingResource.java:35
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "hello";
}
@POST
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.TEXT_PLAIN)
public String hello(String name) {
return "hello " + name;
}
@POST
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
public byte[] hello(byte[] bytes) {
if (bytes[0] != 0 || bytes[1] != 1 || bytes[2] != 2 || bytes[3] != 3) {
throw new RuntimeException("bad input");
}
byte[] rtn = { 4, 5, 6 };
return rtn;
}
@POST
@Path("empty")
public void empty() {
}
@Context
com.amazonaws.services.lambda.runtime.Context ctx;
@GET
@Path("context")
@Produces(MediaType.TEXT_PLAIN)
public void context() {View on GitHub (pinned to e1c734241f)
Solutions
- POST bytes starting with 0x00 0x01 0x02 0x03 and Content-Type application/octet-stream
- Check API Gateway binary media type configuration so the body is not base64-mangled
- Ensure at least 4 bytes are sent to avoid ArrayIndexOutOfBoundsException
- Confirm the reactive variant of the test payload matches the servlet/classic variant's expectations
Example fix
// before
body = {1,1,1,1} // RuntimeException: bad input
// after
body = {0,1,2,3} // returns {4,5,6} Defensive patterns
Strategy: validation
Validate before calling
byte[] bytes = ...;
boolean ok = bytes != null && bytes.length >= 4 && bytes[0]==0 && bytes[1]==1 && bytes[2]==2 && bytes[3]==3;
if (!ok) { /* fix payload before POSTing */ } Try / catch
try {
byte[] rtn = given().body(expected).contentType(ContentType.BINARY).post("/hello").asByteArray();
} catch (RuntimeException e) {
if ("bad input".equals(e.getMessage())) { /* fix payload */ }
} Prevention
- Prefix binary payloads with bytes 0,1,2,3
- Send Content-Type: application/octet-stream
- Send at least 4 bytes to avoid index errors
- Confirm base64 encoding of body in the API Gateway event matches the raw bytes
When it happens
Trigger: POSTing a body whose first four bytes are not {0,1,2,3}, a body shorter than 4 bytes (index out of bounds), or wrong Content-Type causing binary data to be mangled, to /hello on the reactive deployment.
Common situations: Testing binary payload handling in the RESTEasy Reactive Lambda-HTTP app; base64/body-decoding mismatches in API Gateway; clients sending text to an octet-stream endpoint.
Related errors
- bad input
- Unknown start character for json value: %s
- Unexpected index $index
- Unexpected index $index
- Cannot create a Encoder if request is a TRACE
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/8db0336dbcaf3c6d.
Report an issue: GitHub.