{"record":{"id":"8db0336dbcaf3c6d","repo":"quarkusio/quarkus","slug":"bad-input-8db033","errorCode":null,"errorMessage":"bad input","messagePattern":"bad input","errorType":"http","errorClass":"RuntimeException","httpStatus":500,"severity":"info","filePath":"integration-tests/amazon-lambda-http-resteasy-reactive/src/main/java/io/quarkus/it/amazon/lambda/GreetingResource.java","lineNumber":35,"sourceCode":"    @GET\n    @Produces(MediaType.TEXT_PLAIN)\n    public String hello() {\n        return \"hello\";\n    }\n\n    @POST\n    @Produces(MediaType.TEXT_PLAIN)\n    @Consumes(MediaType.TEXT_PLAIN)\n    public String hello(String name) {\n        return \"hello \" + name;\n    }\n\n    @POST\n    @Produces(MediaType.APPLICATION_OCTET_STREAM)\n    @Consumes(MediaType.APPLICATION_OCTET_STREAM)\n    public byte[] hello(byte[] bytes) {\n        if (bytes[0] != 0 || bytes[1] != 1 || bytes[2] != 2 || bytes[3] != 3) {\n            throw new RuntimeException(\"bad input\");\n        }\n        byte[] rtn = { 4, 5, 6 };\n        return rtn;\n    }\n\n    @POST\n    @Path(\"empty\")\n    public void empty() {\n\n    }\n\n    @Context\n    com.amazonaws.services.lambda.runtime.Context ctx;\n\n    @GET\n    @Path(\"context\")\n    @Produces(MediaType.TEXT_PLAIN)\n    public void context() {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/amazon-lambda-http-resteasy-reactive/src/main/java/io/quarkus/it/amazon/lambda/GreetingResource.java#L17-L53","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nbody = {1,1,1,1}   // RuntimeException: bad input\n// after\nbody = {0,1,2,3}   // returns {4,5,6}","handlingStrategy":"validation","validationCode":"byte[] bytes = ...;\nboolean ok = bytes != null && bytes.length >= 4 && bytes[0]==0 && bytes[1]==1 && bytes[2]==2 && bytes[3]==3;\nif (!ok) { /* fix payload before POSTing */ }","typeGuard":null,"tryCatchPattern":"try {\n    byte[] rtn = given().body(expected).contentType(ContentType.BINARY).post(\"/hello\").asByteArray();\n} catch (RuntimeException e) {\n    if (\"bad input\".equals(e.getMessage())) { /* fix payload */ }\n}","preventionTips":["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"],"tags":["http","binary","validation","resteasy-reactive","test"],"backgroundTag":"invalid-request-body","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}