quarkusio/quarkus · error · RuntimeException
Couldn't load object of type ${i.propertyType.getName()} for
Error message
Couldn't load object of type ${i.propertyType.getName()} for property '${i.getName()}' on object '${param}'. Please, check the Bytecode Recording documentation https://quarkus.io/guides/writing-extensions#bytecode-recording to be sure this type is supported to be passed to @Record classes. What it means
While serializing a bean property, loadObjectInstance could not produce a deferred bytecode value for the property value — the property's type is not among the types the bytecode recorder supports (primitives, Strings, enums, collections, maps, registered serializers, other recordable objects, etc.). The error links to the Bytecode Recording docs listing supported types.
Source
Thrown at core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java:1445
}
}
} else {
throw new RuntimeException("Cannot serialise field '" + i.getName() + "' on object '" + param
+ "' of type '" + param.getClass().getName()
+ "' as getter and setter are of different types. Getter type is '"
+ getterReturnType.getName() + "' while setter type is '"
+ setterParameterType.getName()
+ "'.");
}
}
}
DeferredParameter val;
try {
val = loadObjectInstance(propertyValue, existing,
i.getPropertyType(), relaxedValidation);
} catch (Exception e) {
throw new RuntimeException(
"Couldn't load object of type " + i.propertyType.getName() + " for property '" + i.getName()
+ "' on object '" + param
+ "'. Please, check the Bytecode Recording documentation " +
"https://quarkus.io/guides/writing-extensions#bytecode-recording to be sure this type "
+
"is supported to be passed to @Record classes.",
e);
}
if (ctorParamIndex != null) {
nonDefaultConstructorHandles[ctorParamIndex] = val;
ctorSetupSteps.add(new SerializationStep() {
@Override
public void handle(MethodContext context, MethodCreator method, DeferredArrayStoreParameter out) {
}
@Override
public void prepare(MethodContext context) {View on GitHub (pinned to e1c734241f)
Solutions
- Register a custom serializer for the type (implement io.quarkus.deployment.recording.ObjectSerializer and register it)
- Change the property type to a supported one (String, primitives, enums, collections/maps of supported types)
- Annotate the value class with @io.quarkus.runtime.annotations.RegisterForBytecodeRecording if it is a simple bean
- Precompute/transform the value into a supported representation before passing it to the @Record method
Example fix
// before
record Config(URI endpoint) {} // URI unsupported in this spot
// after
record Config(String endpoint) {} // pass endpoint.toString() Defensive patterns
Strategy: validation
Validate before calling
static final Set<Class<?>> SUPPORTED = Set.of(String.class, int.class, boolean.class,
Integer.class, Boolean.class, List.class, Set.class, Map.class);
if (!SUPPORTED.contains(propType) && !propType.isEnum()
&& !propType.isAnnotationPresent(RegisterForBytecodeRecording.class)) {
throw new IllegalStateException("Type not recordable: " + propType);
} Try / catch
try {
recorder.record(value);
} catch (RuntimeException e) {
if (String.valueOf(e.getMessage()).startsWith("Couldn't load object of type")) {
throw new IllegalStateException("Register a serializer or change the property type", e);
}
throw e;
} Prevention
- Restrict recorded bean properties to documented supported types
- Register custom ObjectSerializers for required exotic types
- Annotate simple value classes with @RegisterForBytecodeRecording
- Convert complex types to Strings/maps before passing to @Record methods
When it happens
Trigger: Passing an object with a property of an unsupported type (e.g. java.time custom types without a registered serializer, arbitrary third-party classes, Class<?> handles, lambdas) into a @Record method.
Common situations: Extension config classes containing exotic types; adding a new field of a non-recordable type to an otherwise recordable config object; forgetting to register a ObjectSerializer for a custom type via RegisterForBytecodeRecording or a serialization customizer.
Related errors
- Cannot serialise field '${i.getName()}' on object '${param}'
- Failed to record call to method ${call.method}
- Failed to substitute ${param}
- Unable to serialize ${param} as the wrong number of paramete
- Unable to determine the recordable constructor to use for ${
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/a05f9c91d03b3a23.
Report an issue: GitHub.