FasterXML/jackson-databind · error · IllegalArgumentException
Duplicate property '${prop.getName()}' for ${_beanDescRef.ge
Error message
Duplicate property '${prop.getName()}' for ${_beanDescRef.getType()} What it means
Thrown by BeanDeserializerBuilder.addProperty when two distinct SettableBeanProperty instances with the same name are added (the comment in source says this 'should never occur' under normal introspection). It signals an internal/visibility conflict where introspection produced two different property objects for the same property name rather than merging them.
Source
Thrown at src/main/java/tools/jackson/databind/deser/BeanDeserializerBuilder.java:204
if ((oldProp != null) && (_propsBasedCreatorParams != null)) {
for (int i = 0, len = _propsBasedCreatorParams.length; i < len; ++i) {
if (_propsBasedCreatorParams[i] == oldProp) {
_propsBasedCreatorParams[i] = prop;
}
}
}
}
/**
* Method to add a property setter. Will ensure that there is no
* unexpected override; if one is found will throw a
* {@link IllegalArgumentException}.
*/
public void addProperty(SettableBeanProperty prop)
{
SettableBeanProperty old = _properties.put(prop.getName(), prop);
if (old != null && old != prop) { // should never occur...
throw new IllegalArgumentException("Duplicate property '"+prop.getName()
+"' for "+_beanDescRef.getType());
}
}
/**
* Method called to add a property that represents so-called back reference;
* reference that "points back" to object that has forward reference to
* currently built bean.
*/
public void addBackReferenceProperty(String referenceName, SettableBeanProperty prop)
{
if (_backRefProperties == null) {
_backRefProperties = new HashMap<String, SettableBeanProperty>(4);
}
// 15-Sep-2016, tatu: For some reason fixing access at point of `build()` does
// NOT work (2 failing unit tests). Not 100% clear why, but for now force
// access set early; unfortunate, but since it works....
if (_config.canOverrideAccessModifiers()) {View on GitHub (pinned to 87876ca5c0)
Solutions
- Ensure only one source (field, setter, or creator parameter) maps to each property name; rename duplicates with @JsonProperty.
- Review MapperFeature visibility settings (e.g., AUTO_DETECT_FIELDS/CREATORS/SETTERS) and @JsonAutoDetect on the type.
- Remove or correct mixins that introduce a name collision.
- If merging is intended, use addOrReplaceProperty (internal) or adjust the introspector so the same SettableBeanProperty instance is reused.
Example fix
// before: two fields renamed to the same logical name
class Pojo {
@JsonProperty("value") String a;
@JsonProperty("value") int b;
}
// after: distinct names
class Pojo {
@JsonProperty("a") String a;
@JsonProperty("b") int b;
} Defensive patterns
Strategy: validation
Validate before calling
// After introspection, assert no two distinct properties share a name before building.
Set<String> seen = new HashSet<>();
for (BeanPropertyDefinition p : beanDesc.findProperties()) {
if (!seen.add(p.getName())) {
throw new IllegalStateException("Duplicate property name: " + p.getName());
}
} Prevention
- Give each property a unique logical name; use @JsonProperty to disambiguate.
- Review @JsonAutoDetect / MapperFeature visibility when collisions appear.
- Check mixins do not introduce name collisions.
- Avoid renaming multiple distinct fields to the same JSON name.
When it happens
Trigger: Bean introspection yields two non-identical SettableBeanProperty objects for the same name (e.g., a creator parameter and a field/setter that were not merged due to custom visibility, conflicting field+setter names after renaming, or a mixin that creates a collision).
Common situations: Custom visibility (MapperFeature.AUTO_DETECT_*) that surfaces two sources for one logical name; @JsonProperty renaming two different fields to the same name; a mixin combining properties that collide; records/creators where a parameter and a field share a name but are treated as distinct due to config.
Related errors
- _anySetter already set to non-null
- Invalid Object Id definition for %s: cannot find property wi
- Unsuitable method ({}) decorated with @JsonCreator (for Enum
- Cannot deserialize Class ${type.getName()} (of type ${typeSt
- Cannot deserialize Proxy class ${type.getName()} as a Bean
AI-assisted analysis of FasterXML/jackson-databind@87876ca5c0 (2026-08-11).
Data as JSON: /api/errors/2ae0b4787c851e2a.
Report an issue: GitHub.