quarkusio/quarkus · error · java.lang.IllegalArgumentException
Cannot read '<fieldName>' field from <object> of class <claz
Error message
Cannot read '<fieldName>' field from <object> of class <clazz>
What it means
ReflectionUtil.readField reads a declared field reflectively and wraps any IllegalAccessException or NoSuchFieldException in this IllegalArgumentException naming the field, object, and class. It means the client tried to read an internal field that does not exist (or is not visible) on the actual runtime class — typically after an internal API or version change.
Source
Thrown at independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/ReflectionUtil.java:27
}
/**
* Used by io.quarkus.resteasy.reactive.client.deployment.beanparam.FieldExtractor
*
* @param object object to read the field from
* @param clazz class that declares the field
* @param fieldName name of the field
* @return value of the field
*/
public static Object readField(Object object, Class<?> clazz, String fieldName) {
try {
Field field = clazz.getDeclaredField(fieldName);
if (!field.isAccessible()) {
field.setAccessible(true);
}
return field.get(object);
} catch (IllegalAccessException | NoSuchFieldException e) {
throw new IllegalArgumentException("Cannot read '" + fieldName + "' field from " + object + " of class " + clazz);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Align all RESTEasy Reactive client artifact versions (use the Quarkus BOM) so internal field names match
- Verify the object/class passed to readField is the expected type at runtime
- Upgrade Quarkus/resteasy-reactive to a version where the reflection target exists
Example fix
// before (mismatched versions) resteasy-reactive-client:6.2.0 with core:6.3.0 // after <dependencyManagement><dependencies><dependency> <groupId>io.quarkus.platform</groupId><artifactId>quarkus-bom</artifactId><version>matching</version><type>pom</type><scope>import</scope> </dependency></dependencies></dependencyManagement>
Defensive patterns
Strategy: validation
Validate before calling
try {
clazz.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
throw new IllegalStateException("Expected field " + fieldName + " missing on " + clazz + "; check artifact version alignment");
} Type guard
boolean hasField(Class<?> clazz, String name) {
try { clazz.getDeclaredField(name); return true; }
catch (NoSuchFieldException e) { return false; }
} Try / catch
try {
value = ReflectionUtil.readField(fieldName, object, clazz);
} catch (IllegalArgumentException e) {
throw new IllegalStateException("Library version mismatch: " + e.getMessage(), e);
} Prevention
- Keep all RESTEasy Reactive artifacts on the same version via the Quarkus BOM
- After upgrading Quarkus, rebuild clean to avoid stale internal classes
- Avoid relying on internal reflection utilities in application code
When it happens
Trigger: Internal client code calling ReflectionUtil.readField(fieldName, object, clazz) where the target class has no such declared field (wrong class passed, renamed field, or shaded/different library version at runtime).
Common situations: Mixing mismatched versions of resteasy-reactive artifacts on the classpath; reflection-based extraction of a vert.x or JDK field that changed between versions.
Related errors
- Quarkus code generation phase has failed
- Unexpected mode:
- Could not reflectively call JibContainerBuilder constructor
- Failed to read imageId
- onCancel was already called
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/ad371ed85a7bc250.
Report an issue: GitHub.