OpenFeign/feign · error · IllegalArgumentException
Not supported type
Error message
Not supported type ${type} What it means
JacksonIteratorDecoder decodes streaming Iterator<T> responses; actualIteratorTypeArgument requires the declared return type to be a ParameterizedType whose raw type is java.util.Iterator. Anything else throws IllegalArgumentException 'Not supported type'.
Solutions
- Declare the method return type as Iterator<T> with an explicit type argument.
- Use the regular JacksonDecoder for non-Iterator return types like List<T>.
- Wire JacksonIteratorDecoder only for the streaming methods that need it.
- If T itself is generic, ensure it resolves to a concrete class.
Example fix
// before @GET Iterator getUsers(); // raw Iterator -> Not supported type // after @GET Iterator<User> getUsers();
Defensive patterns
Strategy: type-guard
Validate before calling
static boolean isIteratorType(Type type) {
return type instanceof ParameterizedType
&& java.util.Iterator.class.equals(((ParameterizedType) type).getRawType());
}
// verify each Feign method's generic return type before wiring JacksonIteratorDecoder Type guard
static boolean hasExplicitTypeArgument(java.lang.reflect.Method m) {
return isIteratorType(m.getGenericReturnType());
} Try / catch
try {
return streamingClient.streamUsers();
} catch (feign.codec.DecodeException e) {
if (e.getCause() instanceof IllegalArgumentException && e.getCause().getMessage().startsWith("Not supported type")) {
throw new IllegalStateException("Method must declare Iterator<T>, not raw/other types", e);
}
throw e;
} Prevention
- Always declare Iterator<T> with an explicit type argument
- Wire the iterator decoder only for streaming methods
- Review return types when changing decoder configuration
When it happens
Trigger: Declaring a Feign method with JacksonIteratorDecoder whose return type is Iterator (raw, no generic parameter), List<T>, or any non-Iterator ParameterizedType — e.g. returning raw Iterator without <T>.
Common situations: Forgetting the generic parameter (raw Iterator), accidentally wiring the iterator decoder for methods returning List<T>, copy-pasting decoder config across methods with different return types.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Not an iterator type
- Not supported type
- Not an iterator type
- ${e.getMessage()}
- JAXB only supports decoding raw types. Found
AI-assisted analysis of OpenFeign/feign@e2a1e27560 (2026-09-10).
Data as JSON: /api/errors/0d9871f7c3ea176d.
Report an issue: GitHub.
Appendix: source
Thrown at jackson/src/main/java/feign/jackson/JacksonIteratorDecoder.java:97
// Read the first byte to see if we have any data
reader.mark(1);
if (reader.read() == -1) {
return null; // Eagerly returning null avoids "No content to map due to end-of-input"
}
reader.reset();
return new JacksonIterator<Object>(
actualIteratorTypeArgument(type), mapper, response, reader);
} catch (RuntimeJsonMappingException e) {
if (e.getCause() != null && e.getCause() instanceof IOException) {
throw IOException.class.cast(e.getCause());
}
throw e;
}
}
private static Type actualIteratorTypeArgument(Type type) {
if (!(type instanceof ParameterizedType)) {
throw new IllegalArgumentException("Not supported type " + type.toString());
}
ParameterizedType parameterizedType = (ParameterizedType) type;
if (!Iterator.class.equals(parameterizedType.getRawType())) {
throw new IllegalArgumentException(
"Not an iterator type " + parameterizedType.getRawType().toString());
}
return ((ParameterizedType) type).getActualTypeArguments()[0];
}
public static JacksonIteratorDecoder create() {
return create(Collections.<Module>emptyList());
}
public static JacksonIteratorDecoder create(Iterable<Module> modules) {
return new JacksonIteratorDecoder(
new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.registerModules(modules));View on GitHub (pinned to e2a1e27560)