{"record":{"id":"97cbe929ad90f9c0","repo":"OpenFeign/feign","slug":"not-supported-type-type-97cbe9","errorCode":null,"errorMessage":"Not supported type ${type}","messagePattern":"Not supported type (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"jackson3/src/main/java/feign/jackson3/Jackson3IteratorDecoder.java","lineNumber":100,"sourceCode":"      // Read the first byte to see if we have any data\n      reader.mark(1);\n      if (reader.read() == -1) {\n        return null; // Eagerly returning null avoids \"No content to map due to end-of-input\"\n      }\n      reader.reset();\n      return new Jackson3Iterator<Object>(\n          actualIteratorTypeArgument(type), mapper, response, reader);\n    } catch (JacksonException e) {\n      if (e.getCause() != null && e.getCause() instanceof IOException) {\n        throw IOException.class.cast(e.getCause());\n      }\n      throw e;\n    }\n  }\n\n  private static Type actualIteratorTypeArgument(Type type) {\n    if (!(type instanceof ParameterizedType)) {\n      throw new IllegalArgumentException(\"Not supported type \" + type.toString());\n    }\n    ParameterizedType parameterizedType = (ParameterizedType) type;\n    if (!Iterator.class.equals(parameterizedType.getRawType())) {\n      throw new IllegalArgumentException(\n          \"Not an iterator type \" + parameterizedType.getRawType().toString());\n    }\n    return ((ParameterizedType) type).getActualTypeArguments()[0];\n  }\n\n  public static Jackson3IteratorDecoder create() {\n    return create(Collections.<JacksonModule>emptyList());\n  }\n\n  public static Jackson3IteratorDecoder create(Iterable<JacksonModule> modules) {\n    return new Jackson3IteratorDecoder(\n        JsonMapper.builder()\n            .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)\n            // Disable FAIL_ON_TRAILING_TOKENS for iterator: we read a JSON array element by","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/OpenFeign/feign/blob/e2a1e27560a1e68840c34f031afca88b36096e30/jackson3/src/main/java/feign/jackson3/Jackson3IteratorDecoder.java#L82-L118","documentation":"Jackson3IteratorDecoder only supports return types of the form Iterator<T>. If the declared method return type is not a ParameterizedType (e.g. a raw Iterator, or a non-generic type), decode cannot determine the element type and throws IllegalArgumentException('Not supported type ...').","triggerScenarios":"Declaring a Feign interface method returning raw java.util.Iterator (no generic parameter), or any non-parameterized type (String, List, POJO), and having Jackson3IteratorDecoder selected as the decoder.","commonSituations":"Copy-pasting a method signature and dropping the generic parameter; returning Iterator from a helper whose Type erases generics; wiring Jackson3IteratorDecoder for endpoints that actually return a single object or a List.","solutions":["Change the Feign method signature to return Iterator<ElementDto> with an explicit type parameter","If the endpoint returns a list, use List<ElementDto> with the regular Jackson3Decoder instead","Use IteratorDecoder (wrapped) if you need Iterator<X> inside another generic container - but the outer type must still be parameterized","Check the Contract-resolved MethodMetadata.returnType to confirm generics survived (avoid bridge/raw types)"],"exampleFix":"// before\n@Get(\"/items\") Iterator getItems();\n// after\n@Get(\"/items\") Iterator<ItemDto> getItems();","handlingStrategy":"type-guard","validationCode":"Type t = method.getGenericReturnType();\nif (!(t instanceof ParameterizedType)) {\n  throw new IllegalStateException(\"Decoder requires a parameterized return type, got: \" + t);\n}","typeGuard":"static boolean isIteratorOf(Type t) {\n  return t instanceof ParameterizedType\n      && ((ParameterizedType) t).getRawType() == java.util.Iterator.class;\n}","tryCatchPattern":"try {\n  return iteratorDecoder.decode(response, type);\n} catch (IllegalArgumentException e) {\n  throw new IllegalStateException(\"Use Iterator<T> return types with Jackson3IteratorDecoder: \" + e.getMessage(), e);\n}","preventionTips":["Always declare Iterator<ElementDto> with an explicit type parameter in Feign interfaces","Only register the iterator decoder for methods that genuinely stream Iterator<T>","Use List<T> + Jackson3Decoder for collection endpoints","Review MethodMetadata.returnType in an integration test to catch raw types early"],"tags":["jackson","generics","feign","decoder","illegal-argument"],"backgroundTag":"invalid-argument-value","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"}