FasterXML/jackson-databind · error · UnsupportedOperationException
Cannot call createParameterObject() on {}
Error message
Cannot call createParameterObject() on {} What it means
Thrown by the base SettableAnyProperty.createParameterObject() — the default implementation is unsupported because field/method-based any-setters have no 'parameter object' to create. Only the creator-parameter-based subclass (a Map-typed @JsonAnySetter used as a @JsonCreator argument) supports it; calling it on any other variant throws UnsupportedOperationException.
Source
Thrown at src/main/java/tools/jackson/databind/deser/SettableAnyProperty.java:177
*
* @since 2.18.1
*/
public boolean isFieldType() { return _setterIsField; }
/**
* Method called to check whether this property is method
*
* @return 2.18.2
*/
public boolean isSetterType() { return _setter instanceof AnnotatedMethod; }
/**
* Create an instance of value to pass through Creator parameter.
*
* @since 2.18
*/
public Object createParameterObject() {
throw new UnsupportedOperationException("Cannot call createParameterObject() on " + getClass().getName());
}
/*
/**********************************************************************
/* Public API, deserialization
/**********************************************************************
*/
/**
* Method called to deserialize appropriate value, given parser (and
* context), and set it using appropriate method (a setter method).
*/
public void deserializeAndSet(JsonParser p, DeserializationContext ctxt,
Object instance, String propName)
throws JacksonException
{
try {
Object key = (_keyDeserializer == null) ? propNameView on GitHub (pinned to a50c7d2a1d)
Solutions
- If you need a creator-parameter any-setter, declare @JsonAnySetter on a Map-typed parameter of a @JsonCreator constructor/factory (the supported creator form).
- If using field/method @JsonAnySetter, don't rely on createParameterObject(); ensure the deserializer uses the per-key deserializeAndSet path.
- Remove the conflicting @JsonCreator or realign it with the any-setter shape.
- Avoid calling createParameterObject() from custom code unless you've confirmed the variant via isFieldType()/isSetterType().
Example fix
// before: field-based any-setter combined with a creator expecting a map -> mismatch
class Bag {
private Map<String,Object> props = new HashMap<>();
@JsonAnySetter public void add(String k, Object v){ props.put(k, v); }
@JsonCreator public Bag(@JsonProperty("props") Map<String,Object> p){ ... }
}
// after: any-setter as a creator parameter (supported form)
class Bag {
private final Map<String,Object> props;
@JsonCreator public Bag(@JsonAnySetter Map<String,Object> props){ this.props = props; }
} Defensive patterns
Strategy: validation
Validate before calling
if (anyProperty.isFieldType() || anyProperty.isSetterType()) {
// field/method form: createParameterObject() is unsupported
throw new UnsupportedOperationException(
"createParameterObject() only valid for creator-parameter any-setters");
}
Object paramObj = anyProperty.createParameterObject(); Try / catch
try {
return anyProperty.createParameterObject();
} catch (UnsupportedOperationException e) {
// any-setter is field/method form; fall back to per-key deserializeAndSet
return null;
} Prevention
- Keep @JsonAnySetter and @JsonCreator consistent: creator-parameter form (Map arg) OR field/method form — not mixed.
- Don't call createParameterObject() on field/method any-setters; use deserializeAndSet per key.
- When upgrading Jackson, re-test types that combine @JsonAnySetter with @JsonCreator.
When it happens
Trigger: A bean declares @JsonAnySetter on a field or a single-arg setter method (NOT a creator Map parameter), and the deserialization path or a direct caller invokes createParameterObject(). Usually surfaces as an internal mismatch when @JsonAnySetter is combined with @JsonCreator in an incompatible way.
Common situations: Mixing field/method @JsonAnySetter with a @JsonCreator whose signature implies a collect-any Map that doesn't exist; upgrading Jackson where any-setter/creator resolution changed; calling the API directly from custom deserialization code without checking the any-setter form.
Related errors
- Cannot call withValueDeserializer() on {}
- Duplicate creator property "%s" (index %s vs %d) for type %s
- Conflicting %s creators: already had %s creator %s, encounte
- Invalid abstract type resolution from {} to {}: latter is no
- Only support `JavaType` implementation of `ResolvedType`, no
AI-assisted analysis of FasterXML/jackson-databind@a50c7d2a1d (2026-08-06).
Data as JSON: /api/errors/d047d57dfe4779ee.
Report an issue: GitHub.