FasterXML/jackson-databind · error · UnsupportedOperationException
Should not call set() on ObjectIdProperty that has no Settab
Error message
Should not call set() on ObjectIdProperty that has no SettableBeanProperty
What it means
ObjectIdValueProperty.setAndReturn/set delegates to an underlying SettableBeanProperty obtained from ObjectIdReader; if that property is null (the ObjectIdReader was constructed without an idProperty), there is no target to receive the id value, and the call is rejected. This typically indicates a misconfigured ObjectIdReader or a code path that should not call set on an id-only property.
Source
Thrown at src/main/java/tools/jackson/databind/deser/impl/ObjectIdValueProperty.java:150
if (idProp.isCreatorProperty()) {
return instance;
}
return idProp.setAndReturn(ctxt, instance, id);
}
return instance;
}
@Override
public void set(DeserializationContext ctxt,Object instance, Object value) {
setAndReturn(ctxt, instance, value);
}
@Override
public Object setAndReturn(DeserializationContext ctxt, Object instance, Object value)
{
SettableBeanProperty idProp = _objectIdReader.idProperty;
if (idProp == null) {
throw new UnsupportedOperationException(
"Should not call set() on ObjectIdProperty that has no SettableBeanProperty");
}
// [databind#4729] Records/Creators do not have setters, skip
if (idProp.isCreatorProperty()) {
return instance;
}
return idProp.setAndReturn(ctxt, instance, value);
}
}
View on GitHub (pinned to 87876ca5c0)
Solutions
- Build ObjectIdReader with a non-null SettableBeanProperty (use ObjectIdReader.create with the proper idProperty).
- If the id is bound through a creator parameter (record/builder), ensure idProperty.isCreatorProperty() returns true so set() short-circuits before reaching the null guard.
- Avoid calling set() on ObjectIdValueProperty directly in custom code; rely on the framework's binding.
Example fix
// before ObjectIdReader reader = ObjectIdReader.construct(type, propName, gen, resolver, null, false); // idProperty null -> set() throws later // after SettableBeanProperty idProp = ...; // real property for the id ObjectIdReader reader = ObjectIdReader.construct(type, propName, gen, resolver, idProp, false);
Defensive patterns
Strategy: validation
Validate before calling
ObjectIdReader reader = ...;
if (reader.idProperty == null) {
throw new IllegalStateException("ObjectIdReader needs a non-null idProperty");
} Type guard
static boolean hasIdProperty(ObjectIdReader r) {
return r != null && r.idProperty != null;
} Try / catch
try { idProp.set(ctxt, bean, value); }
catch (UnsupportedOperationException e) {
if (e.getMessage().contains("no SettableBeanProperty")) {
// build ObjectIdReader with a real idProperty
} else throw e;
} Prevention
- Always construct ObjectIdReader with a non-null SettableBeanProperty for the id.
- For records/builders, ensure the id property is a creator property so set() short-circuits.
When it happens
Trigger: Constructing an ObjectIdReader with a null idProperty (e.g. custom resolver wiring); framework code that calls set()/setAndReturn() on an ObjectIdValueProperty whose backing SettableBeanProperty was never set; immutability/records path where the id is bound via the creator and set() should be a no-op.
Common situations: Custom ObjectIdReader construction; Jackson internals calling set() on an id property that only participates in creator binding; record types where @JsonIdentityInfo id flows through the constructor (the isCreatorProperty guard returns early, but if idProperty is null even that path throws).
Related errors
- Could not resolve Object Id [${id}] (for ${_beanType}).
- Failed to parse Date value '%s': %s
- AnnotationIntrospector returned `Class<${deserClass.getName(
- AnnotationIntrospector returned key deserializer definition
- AnnotationIntrospector returned Class ${deserClass.getName()
AI-assisted analysis of FasterXML/jackson-databind@87876ca5c0 (2026-08-11).
Data as JSON: /api/errors/af295d841b9a97f9.
Report an issue: GitHub.