{"record":{"id":"e7f53247006692f1","repo":"quarkusio/quarkus","slug":"failed-to-decode","errorCode":null,"errorMessage":"Failed to decode: ","messagePattern":"Failed to decode: ","errorType":"exception","errorClass":"DecodeException","httpStatus":null,"severity":"error","filePath":"extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/jackson/QuarkusJacksonJsonCodec.java","lineNumber":194,"sourceCode":"            parser.close();\n        } catch (IOException ignore) {\n        }\n    }\n\n    @SuppressWarnings(\"rawtypes\")\n    private static Object adapt(Object o) {\n        try {\n            if (o instanceof List) {\n                List list = (List) o;\n                return new JsonArray(list);\n            } else if (o instanceof Map) {\n                @SuppressWarnings(\"unchecked\")\n                Map<String, Object> map = (Map<String, Object>) o;\n                return new JsonObject(map);\n            }\n            return o;\n        } catch (Exception e) {\n            throw new DecodeException(\"Failed to decode: \" + e.getMessage());\n        }\n    }\n}\n","sourceCodeStart":176,"sourceCodeEnd":198,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/jackson/QuarkusJacksonJsonCodec.java#L176-L198","documentation":"QuarkusJacksonJsonCodec.adapt converts raw Jackson output (JsonNode, LinkedHashMap, etc.) into Vert.x JsonObject/JsonArray or plain values; any exception during decoding is wrapped in DecodeException with the message 'Failed to decode: ' plus the underlying cause message. It is invoked from fromValue and fromParser when turning buffers/values into typed objects.","triggerScenarios":"Calling fromBuffer/fromValue/fromParser with malformed JSON bytes, or a target type Jackson cannot map the JSON to (wrong fields, incompatible types, missing no-arg constructor).","commonSituations":"Consuming event bus messages produced by a non-Java sender with a different JSON shape; target class changed fields (version drift); sending primitives where a JsonObject was expected; corrupted or truncated buffers.","solutions":["Inspect the cause message after 'Failed to decode:' to find the mismatching property","Validate/constrain the incoming JSON shape before decoding (e.g. @JsonIgnoreProperties(ignoreUnknown = true) on the target class)","Verify the sender serializes with a compatible schema and encoding","Add a default constructor and matching field types to the target class"],"exampleFix":"// before\n@JsonIgnoreProperties // absent; unknown fields cause decode failure\npublic class Order { private String id; }\n\n// after\n@JsonIgnoreProperties(ignoreUnknown = true)\npublic class Order { private String id; }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    Order order = codec.fromBuffer(buffer, Order.class);\n} catch (DecodeException e) {\n    log.errorf(e, \"Bad event bus payload: %s\", e.getMessage());\n    // dead-letter or reply with error\n}","preventionTips":["Add @JsonIgnoreProperties(ignoreUnknown = true) to event bus DTOs","Share a common schema/DTO module between producers and consumers","Unit-test decoders against sample payloads from every producer version"],"tags":["jackson","json","deserialization","vertx"],"backgroundTag":"json-decode-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"}