{"record":{"id":"759521421ad9fc5f","repo":"OpenFeign/feign","slug":"type-gettypename-is-not-a-type-supported-by-t","errorCode":null,"errorMessage":"${type.getTypeName()} is not a type supported by this decoder.","messagePattern":"(.+?) is not a type supported by this decoder\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"json/src/main/java/feign/json/JsonDecoder.java","lineNumber":116,"sourceCode":"          format(\"%s is not a type supported by this decoder.\", type),\n          response.request());\n  }\n\n  @Override\n  public Object convert(Object object, Type type) throws IOException {\n    if (type instanceof Class) {\n      Class<?> cls = (Class<?>) type;\n      if (cls == JSONObject.class && object instanceof Map) {\n        return new JSONObject((Map<?, ?>) object);\n      }\n      if (cls == String.class) {\n        return object.toString();\n      }\n    }\n    if (object instanceof Map) {\n      return new JSONObject((Map<?, ?>) object);\n    }\n    throw new IOException(type.getTypeName() + \" is not a type supported by this decoder.\");\n  }\n\n  @Override\n  public boolean canDecode(Response response, Type type) {\n    return Util.isJsonContentType(response);\n  }\n}\n","sourceCodeStart":98,"sourceCodeEnd":124,"githubUrl":"https://github.com/OpenFeign/feign/blob/e2a1e27560a1e68840c34f031afca88b36096e30/json/src/main/java/feign/json/JsonDecoder.java#L98-L124","documentation":"JsonEncoder/JsonDecoder's convert() method (used to coerce objects into org.json structures) throws an IOException naming the type when the object is neither a JSONObject, JSONArray, nor Map. It signals an incompatibility between the Java object being converted and the org.json model.","triggerScenarios":"Calling convert() with a plain POJO, primitive wrapper, List, or other non-Map/non-org.json object as the source type.","commonSituations":"Attempting to reuse JsonDecoder/JsonEncoder internals for arbitrary object conversion; feeding a Collection or custom bean where a Map or org.json type is required.","solutions":["Convert the object to a Map before passing it to convert()","Wrap collections manually into JSONArray/JSONObject first","Use a full data-binding encoder/decoder (Jackson/Gson) for POJOs"],"exampleFix":"// before\nObject out = decoder.convert(myPojo, MyPojo.class); // IOException\n// after\nMap<String, Object> map = pojoToMap(myPojo);\nObject out = decoder.convert(map, Map.class);","handlingStrategy":"type-guard","validationCode":"if (!(src instanceof Map) && !(src instanceof JSONObject) && !(src instanceof JSONArray)) {\n  throw new IllegalArgumentException(\"convert() needs Map or org.json type, got \" + src.getClass());\n}","typeGuard":"boolean convertible(Object o){ return o instanceof Map || o instanceof JSONObject || o instanceof JSONArray; }","tryCatchPattern":"try { return convert(obj, type); }\ncatch (IOException e) { throw new IllegalArgumentException(\"Unsupported source: \" + obj.getClass(), e); }","preventionTips":["Only feed Maps and org.json types into JsonDecoder conversion helpers","Serialize POJOs with a dedicated mapper first"],"tags":["json","type-mismatch","feign"],"backgroundTag":"incompatible-source-type","analyzedSha":"e2a1e27560a1e68840c34f031afca88b36096e30","analyzedAt":"2026-09-10T12:37:37.238Z","contentChangedAt":"2026-09-10T12:37:37.238Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}