pinpoint-apm/pinpoint · warning · IllegalArgumentException
Unexpected argument:
Error message
Unexpected argument:
What it means
TypeUtils.getWrapperOf maps a primitive Class (int.class, void.class, ...) to its wrapper class. If passed a Class that is neither primitive nor any recognized primitive type, there is no wrapper and IllegalArgumentException is thrown.
Source
Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/util/TypeUtils.java:48
} else if (primitive == byte.class) {
return Byte.class;
} else if (primitive == char.class) {
return Character.class;
} else if (primitive == short.class) {
return Short.class;
} else if (primitive == int.class) {
return Integer.class;
} else if (primitive == long.class) {
return Long.class;
} else if (primitive == float.class) {
return Float.class;
} else if (primitive == double.class) {
return Double.class;
} else if (primitive == void.class) {
return Void.class;
}
throw new IllegalArgumentException("Unexpected argument: " + primitive);
}
public static String[] toClassNames(Class<?>... classes) {
final int length = classes.length;
final String[] result = new String[length];
for (int i = 0; i < length; i++) {
result[i] = classes[i].getName();
}
return result;
}
public static <T extends Annotation> T findAnnotation(Annotation[] annotations, Class<T> type) {
for (Annotation a : annotations) {
if (a.annotationType() == type) {
return type.cast(a);
}
}View on GitHub (pinned to 744c3d3075)
Solutions
- Only call getWrapperOf when clazz.isPrimitive() is true
- Add an isPrimitive() guard or use a switch on the primitive type before mapping
- Handle non-primitive classes separately (they need no wrapper)
Example fix
// before Class<?> wrapper = TypeUtils.getWrapperOf(String.class); // throws // after Class<?> wrapper = clazz.isPrimitive() ? TypeUtils.getWrapperOf(clazz) : clazz;
Defensive patterns
Strategy: type-guard
Validate before calling
if (!primitive.isPrimitive()) { throw new IllegalArgumentException("expected primitive: " + primitive); } Type guard
boolean isSupportedPrimitive(Class<?> c) { return c.isPrimitive() && c != void.class; } Try / catch
try { wrapper = TypeUtils.getWrapperOf(c); } catch (IllegalArgumentException e) { wrapper = c; } Prevention
- Check Class.isPrimitive() before calling getWrapperOf
- Treat non-primitive classes as already boxed (no mapping needed)
- Cover all nine primitives in any custom mapping switch
When it happens
Trigger: Calling TypeUtils.getWrapperOf(clazz) with a non-primitive Class (e.g. String.class) or an unrecognized primitive; the if/else chain covers all nine primitives, so anything else throws.
Common situations: Passing boxed classes or arbitrary parameter classes to getWrapperOf instead of checking Class.isPrimitive() first; generic signature-processing code that assumes primitives.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- initialize fail Caused by:
- invoke fail Caused by:
- bootstrapClassLoader not found Caused by:
- bootstrapClassLoader access fail Caused by:
- boot method invoke failed. Error:
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/56d48ff9e05e27c7.
Report an issue: GitHub.