{"record":{"id":"f52716b659e006fc","repo":"quarkusio/quarkus","slug":"could-not-deserialize-the-provided-message","errorCode":null,"errorMessage":"Could not deserialize the provided message.","messagePattern":"Could not deserialize the provided message\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/funqy/funqy-amazon-lambda/runtime/src/main/java/io/quarkus/funqy/lambda/event/AwsEventInputReader.java","lineNumber":64,"sourceCode":"        // configure the mapper for advanced event handling\n        final SimpleModule simpleModule = new SimpleModule();\n        simpleModule.addDeserializer(Date.class, new DateDeserializer());\n        builder.addModule(simpleModule);\n        builder.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);\n\n        this.mapper = builder.build();\n        this.amazonBuildTimeConfig = amazonBuildTimeConfig;\n        this.reader = reader;\n    }\n\n    @Override\n    public Object readValue(InputStream is) throws IOException {\n        try {\n            return safelyReadValue(is);\n        } catch (JacksonException e) {\n            // to make sure that we do not expose too many details about the issue in the lambda response\n            // we have some special treatment for jackson related issues\n            throw new IllegalArgumentException(\"Could not deserialize the provided message.\", e);\n        }\n    }\n\n    private Object safelyReadValue(final InputStream is) throws IOException {\n        final JsonNode rootNode = mapper.readTree(is);\n\n        if (amazonBuildTimeConfig.advancedEventHandling().enabled()) {\n            if (rootNode.isObject() || rootNode.isArray()) {\n                if (rootNode.isObject()) {\n                    // object\n                    ObjectNode object = (ObjectNode) rootNode;\n\n                    if (object.has(\"Records\") && object.get(\"Records\").isArray()) {\n                        // We need to look into the first record entry, to distinguish the different types.\n                        for (JsonNode record : object.get(\"Records\")) {\n                            return deserializeEvent(record, object);\n                        }\n                    }","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/funqy/funqy-amazon-lambda/runtime/src/main/java/io/quarkus/funqy/lambda/event/AwsEventInputReader.java#L46-L82","documentation":"Funqy's AWS Lambda event input reader wraps any Jackson deserialization failure (JacksonException) of the incoming event payload into a generic IllegalArgumentException. This hides Jackson internals so that too many details are not exposed in the Lambda response. The original JacksonException is preserved as the cause.","triggerScenarios":"readValue(InputStream) is called with a stream that is not valid JSON, has the wrong shape for the target function parameter type, or is empty/truncated.","commonSituations":"Invoking a Funqy Lambda with a hand-crafted test event that is not valid JSON; sending a payload that does not match the function's input POJO (missing/renamed fields, wrong types); API Gateway or SQS events hitting a function expecting raw JSON.","solutions":["Log/inspect the raw event payload and validate it is well-formed JSON before invoking the Lambda","Check the funq method's input parameter type matches the actual event body structure","Inspect the JacksonException attached as the cause of the IllegalArgumentException for the real deserialization error","If the input is an AWS event type (SQS/DynamoDB/etc.), use the dedicated event handler / take the specific event type as the funq parameter instead of plain JSON"],"exampleFix":"// before: sending invalid JSON body to function\nlambda.invoke(\"{not valid json\");\n// after: send valid JSON matching the funq input type\nlambda.invoke(\"{\\\"name\\\":\\\"world\\\"}\");","handlingStrategy":"try-catch","validationCode":"// validate payload before invoking\ntry (InputStream is = payloadStream) {\n    new ObjectMapper().readTree(is); // throws if not valid JSON\n}","typeGuard":null,"tryCatchPattern":"try {\n    result = invokeLambda(payload);\n} catch (IllegalArgumentException e) {\n    // JacksonException cause holds the details\n    log.error(\"Invalid event payload\", e.getCause());\n    return badRequestResponse();\n}","preventionTips":["Validate the event body is well-formed JSON before invoking","Keep the funq input POJO in sync with the actual event schema","Test locally with real AWS event samples"],"tags":["jackson","deserialization","aws-lambda","funqy"],"backgroundTag":"json-deserialization-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}