FasterXML/jackson-databind · error · IllegalArgumentException
Conflicting creators: already had creator , encountered…
Error message
Conflicting %s creators: already had %s creator %s, encountered another: %s
What it means
CreatorCollector found two creators of the same kind (two constructors, or two factories, etc.) competing for the same creator slot. Jackson allows at most one creator per category (default, delegating, property-based) unless mode is explicitly disambiguated; otherwise the conflict is reported.
Solutions
- Keep exactly one @JsonCreator per mode; remove redundant annotations or mark one @JsonCreator(Mode.DISABLED).
- If two creators are needed, disambiguate with explicit Mode (Mode.DELEGATING vs Mode.PROPERTIES) so each occupies a different slot.
- For builder types, annotate the builder constructor/factory and let the build() method be discovered separately.
- Add @JsonCreator on the canonical constructor only and let Jackson auto-detect the others as regular.
Example fix
// before
public class Foo {
@JsonCreator public Foo(int x) {}
@JsonCreator public static Foo of(int x) { return new Foo(x); } // conflict
}
// after
public class Foo {
@JsonCreator(Mode.DELEGATING) public Foo(int x) {}
@JsonCreator(Mode.PROPERTIES) public static Foo of(@JsonProperty("x") int x) { return new Foo(x); }
} Defensive patterns
Strategy: validation
Validate before calling
List<AnnotatedWithParams> props = collectPropertyCreators(type);
if (props.size() > 1) {
throw new IllegalStateException("Multiple property creators on " + type);
} Type guard
// no type guard; creator-conflict is runtime introspection
Try / catch
try { mapper.readValue(json, Foo.class); }
catch (IllegalArgumentException e) {
if (e.getMessage().contains("Conflicting")) {
// disambiguate with @JsonCreator(Mode.X) or remove one creator
} else throw e;
} Prevention
- Keep exactly one @JsonCreator per Mode on a type.
- For builders, annotate only the factory and let build() be discovered separately.
When it happens
Trigger: Multiple @JsonCreator constructors/factories on the same type; a constructor and a factory method both annotated @JsonCreator(Mode.PROPERTIES); two property-based constructors where neither is marked explicit and Jackson cannot pick; an implicit public constructor colliding with an explicitly annotated one in some configurations.
Common situations: Builder-style types with both a constructor and a static factory; refactor introducing a second creator without removing the first; third-party types with multiple constructors; Kotlin data classes plus an extra @JsonCreator.
Related errors
- Duplicate creator property
- Cannot call createParameterObject() on
- AnnotationIntrospector returned `Class<
- AnnotationIntrospector returned Class
- AnnotationIntrospector returned Class
AI-assisted analysis of FasterXML/jackson-databind@87876ca5c0 (2026-08-11).
Data as JSON: /api/errors/44e986e536b2f767.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/tools/jackson/databind/deser/bean/CreatorCollector.java:340
} else {
// 02-May-2020, tatu: Should this only result in exception if both
// explicit? Doing so could lead to arbitrary choice between
// multiple implicit creators tho?
_reportDuplicateCreator(typeIndex, explicit, oldOne, newOne);
}
}
}
if (explicit) {
_explicitCreators |= mask;
}
_creators[typeIndex] = _fixAccess(newOne);
return true;
}
// @since 2.12
protected void _reportDuplicateCreator(int typeIndex, boolean explicit,
AnnotatedWithParams oldOne, AnnotatedWithParams newOne) {
throw new IllegalArgumentException("Conflicting %s creators: already had %s creator %s, encountered another: %s".formatted(
TYPE_DESCS[typeIndex],
explicit ? "explicitly marked"
: "implicitly discovered",
oldOne, newOne));
}
/**
* Helper method for recognizing `Enum.valueOf()` factory method
*/
protected boolean _isEnumValueOf(AnnotatedWithParams creator) {
return ClassUtil.isEnumType(creator.getDeclaringClass())
&& "valueOf".equals(creator.getName());
}
}
View on GitHub (pinned to 87876ca5c0)