FasterXML/jackson-databind · error · IllegalArgumentException

Duplicate creator property "%s" (index %s vs %d) for type %s

Error message

Duplicate creator property "%s" (index %s vs %d) for type %s 

What it means

Thrown by CreatorCollector.addPropertyCreator when a property-based creator (@JsonCreator(Mode.PROPERTIES) or auto-detected properties-creator) has two or more parameters with the same name. The method builds a HashMap of property names to indices during creator registration and detects the collision, reporting both the old and new index positions and the type. This is a bean-definition error, not a data error — the class itself has an ambiguous creator.

Source

Thrown at src/main/java/tools/jackson/databind/deser/bean/CreatorCollector.java:182

    public void addPropertyCreator(AnnotatedWithParams creator,
            boolean explicit, SettableBeanProperty[] properties)
    {
        if (verifyNonDup(creator, C_PROPS, explicit)) {
            // Better ensure we have no duplicate names either...
            if (properties.length > 1) {
                HashMap<String, Integer> names = new HashMap<>();
                for (int i = 0, len = properties.length; i < len; ++i) {
                    String name = properties[i].getName();
                    // Need to consider Injectables, which may not have
                    // a name at all, and need to be skipped
                    // (same for possible AnySetter)
                    if (name.isEmpty() && (properties[i].getInjectableValueId() != null)) {
                        continue;
                    }
                    Integer old = names.put(name, Integer.valueOf(i));
                    if (old != null) {
                        throw new IllegalArgumentException("Duplicate creator property \"%s\" (index %s vs %d) for type %s ".formatted(
                                name, old, i, ClassUtil.nameOf(_beanType.getRawClass())));
                    }
                }
            }
            _propertyBasedArgs = properties;
        }
    }

    /*
    /**********************************************************
    /* Accessors
    /**********************************************************
     */

    public boolean hasDefaultCreator() {
        return _creators[C_DEFAULT] != null;
    }

View on GitHub (pinned to a50c7d2a1d)

Solutions

  1. Inspect the constructor/factory method reported in the error for duplicate @JsonProperty values and make each unique.
  2. If using records, check that no two record components resolve to the same JSON property name.
  3. Check for mixins that might alias two different parameters to the same name.
  4. Use -parameters compiler flag if relying on parameter names, ensuring they are distinct.

Example fix

// before
@JsonCreator
public Person(@JsonProperty("name") String name,
              @JsonProperty("name") String fullName) { }
// after
@JsonCreator
public Person(@JsonProperty("name") String name,
              @JsonProperty("fullName") String fullName) { }
Defensive patterns

Strategy: validation

Validate before calling

// Before deploying, validate creator parameters for name uniqueness
Constructor<?> ctor = MyClass.class.getDeclaredConstructors()[0];
Set<String> names = new HashSet<>();
for (Parameter p : ctor.getParameters()) {
    String name = p.isAnnotationPresent(JsonProperty.class)
        ? p.getAnnotation(JsonProperty.class).value() : p.getName();
    if (!names.add(name)) {
        throw new IllegalStateException("Duplicate creator param: " + name);
    }
}

Try / catch

try {
    mapper.readValue(json, MyClass.class);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Duplicate creator property")) {
        // fix the bean definition — this is not a data error
    }
}

Prevention

When it happens

Trigger: A constructor or factory method annotated with @JsonCreator where two parameters share the same @JsonProperty value. A record or class where two constructor parameters resolve to the same name (e.g., both default to empty string or the same name). Using @JsonProperty("name") on two parameters of the same creator.

Common situations: Migrating to records where parameter names collide. Copy-paste errors in @JsonProperty annotations. A class with a @JsonCreator constructor and a mixin that renames properties to cause collision. IDE auto-generating constructors with duplicated parameter names.

Related errors


AI-assisted analysis of FasterXML/jackson-databind@a50c7d2a1d (2026-08-06). Data as JSON: /api/errors/e6f4a127e5c4f57f. Report an issue: GitHub.