{"record":{"id":"41b97b1ebd036ef8","repo":"eclipse-vertx/vert.x","slug":"failed-to-decode-41b97b","errorCode":null,"errorMessage":"Failed to decode","messagePattern":"Failed to decode","errorType":"exception","errorClass":"DecodeException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/json/jackson/JacksonCodec.java","lineNumber":512,"sourceCode":"    } else if (json instanceof Float) {\n      generator.writeNumber((Float) json);\n    } else if (json instanceof Double) {\n      generator.writeNumber((Double) json);\n    } else if (json instanceof Byte) {\n      generator.writeNumber((Byte) json);\n    } else if (json instanceof BigInteger) {\n      generator.writeNumber((BigInteger) json);\n    } else if (json instanceof BigDecimal) {\n      generator.writeNumber((BigDecimal) json);\n    } else {\n      generator.writeNumber(((Number) json).doubleValue());\n    }\n  }\n\n  private static <T> T cast(Object o, Class<T> clazz) {\n    if (o instanceof Map) {\n      if (!clazz.isAssignableFrom(Map.class)) {\n        throw new DecodeException(\"Failed to decode\");\n      }\n      if (clazz == Object.class) {\n        o = new JsonObject((Map) o);\n      }\n      return clazz.cast(o);\n    } else if (o instanceof List) {\n      if (!clazz.isAssignableFrom(List.class)) {\n        throw new DecodeException(\"Failed to decode\");\n      }\n      if (clazz == Object.class) {\n        o = new JsonArray((List) o);\n      }\n      return clazz.cast(o);\n    } else if (o instanceof String) {\n      String str = (String) o;\n      if (clazz.isEnum()) {\n        o = Enum.valueOf((Class<Enum>) clazz, str);\n      } else if (clazz == byte[].class) {","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/json/jackson/JacksonCodec.java#L494-L530","documentation":"JSON decoding failure surfaced by JacksonCodec.cast (via fromParser): the parsed JSON tree could not be converted to the requested target type (e.g. expecting a JsonObject/JsonArray but the JSON is a scalar or mismatched structure). The message 'Failed to decode' is a generic sentinel; the input at fault is the JSON payload versus the expected type.","triggerScenarios":"Thrown at vertx-core/src/main/java/io/vertx/core/json/jackson/JacksonCodec.java:512 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the JSON structure matches the expected type (object vs array vs scalar)","Use fromJson with the correct target type or validate the payload shape first"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}