quarkusio/quarkus · error · IllegalArgumentException
Unsupported object of type ${object.getClass()}. Supported t
Error message
Unsupported object of type ${object.getClass()}. Supported types are Type, String and Class What it means
TypeUtils.toGizmoType converts an object representing a Java type (Gizmo Type, class name String, or Class literal) into a Gizmo Type for bytecode generation. If the argument is none of those three types, an IllegalArgumentException naming the actual type is thrown during augmentation.
Source
Thrown at extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/utils/TypeUtils.java:41
private TypeUtils() {
}
public static Object primitiveToClass(String type) {
Class<?> clazz = PRIMITIVE_TO_CLASS_MAPPING.get(type);
return clazz != null ? clazz : type;
}
public static Type toGizmoType(Object object) {
if (object instanceof Type) {
return (Type) object;
} else if (object instanceof String) {
return Type.classType((String) object);
} else if (object instanceof Class) {
return Type.classType((Class<?>) object);
}
throw new IllegalArgumentException("Unsupported object of type " + object.getClass()
+ ". Supported types are Type, String and Class");
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Pass a Class object, a fully-qualified class name String, or a Gizmo/ASM Type instead of the unsupported object.
- If you have a java.lang.reflect.Type, unwrap it: for Class use it directly; for ParameterizedType call getRawType().
- Convert a class name to Class via Class.forName(...)/loadClass before calling the utility.
Example fix
// before typeUtils.toGizmoType(genericReflectType); // ParameterizedType // after Class<?> raw = (Class<?>) ((ParameterizedType) genericReflectType).getRawType(); typeUtils.toGizmoType(raw);
Defensive patterns
Strategy: type-guard
Type guard
static boolean isGizmoConvertible(Object o) {
return o instanceof org.objectweb.asm.Type
|| o instanceof String
|| o instanceof Class;
}
// call site:
if (!isGizmoConvertible(obj)) {
throw new IllegalArgumentException("Expected Type/String/Class, got " + obj.getClass());
}
Type t = toGizmoType(obj); Prevention
- Always pass Class<?>, String FQN, or ASM Type into type-conversion utilities.
- Unwrap java.lang.reflect.ParameterizedType via getRawType() first.
- Never pass OpenAPI Schema model objects or reflection Types directly.
- Unit-test converters with each accepted input type.
When it happens
Trigger: Deployment time, when internal code (or custom code reusing this util) passes something other than org.objectweb.asm Type, String, or Class to toGizmoType — e.g. a java.lang.reflect.Type, ParameterizedType, or null-derived wrapper from schema resolution.
Common situations: Developer extending/patching the resource generator passes a reflection Type or generic type token instead of a Class/String; refactor swapped an argument order; a custom method implementor feeds an OpenAPI Schema type object into the utility.
Related errors
- Name cannot start with '/':${name}
- messageStarts cannot be empty
- 'target' can only be a class, a field or a method: <target>
- REST Data Panache can only work if 'quarkus-rest' or 'quarku
- Reactive REST Data Panache does not work with 'quarkus-reste
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/e164daadf0ae3b8d.
Report an issue: GitHub.