FasterXML/jackson-databind · error · IllegalArgumentException
Conflicting %s creators: already had %s creator %s, encounte
Error message
Conflicting %s creators: already had %s creator %s, encountered another: %s
What it means
Thrown by CreatorCollector._reportDuplicateCreator via verifyNonDup when two creator methods of the same category (e.g., two property-based creators, two delegate creators, two string-creators) are detected and cannot be disambiguated. The verifyNonDup logic tries to resolve conflicts based on explicitness and type specificity, but when both are equally explicit with the same parameter type, it reports a conflict. This is a bean-definition configuration problem.
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 a50c7d2a1d)
Solutions
- Designate exactly one creator per category (property-based, delegate, string, int, etc.) — remove or re-annotate the duplicate.
- If both are needed for different scenarios, use @JsonCreator with explicit Mode (PROPERTIES vs DELEGATING) to disambiguate.
- Adjust MapperFeature visibility settings (e.g., INFER_CREATOR_MODE_FROM_CONSTRUCTOR_PROPERTIES) if the conflict is from auto-detection.
- Annotate only the intended creator; let the other remain unannotated so it is not auto-detected.
Example fix
// before
@JsonCreator public Foo(String s) { ... }
@JsonCreator public static Foo of(String s) { ... }
// after: keep only one
@JsonCreator public static Foo of(String s) { ... } Defensive patterns
Strategy: validation
Validate before calling
// Before deploying, check for multiple creators
List<AnnotatedWithParams> creators = ...;
Map<Integer, Long> byType = creators.stream()
.collect(Collectors.groupingBy(c -> categorize(c), Collectors.counting()));
byType.forEach((type, count) -> {
if (count > 1) throw new IllegalStateException("Multiple type-" + type + " creators");
}); Try / catch
try {
mapper.readValue(json, MyClass.class);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Conflicting")) {
// fix creator annotations — this is a bean definition error
}
} Prevention
- Annotate only one constructor or factory method as @JsonCreator per category.
- If multiple creators exist, use explicit Mode to disambiguate.
- Run a quick deserialization smoke test at startup to catch creator conflicts early.
When it happens
Trigger: Two constructors/factory methods both annotated with @JsonCreator(Mode.PROPERTIES) or @JsonCreator(Mode.DELEGATING). Two factory methods with the same single-parameter type both marked as creators. A class where auto-detection finds two candidates of the same kind with equal precedence.
Common situations: Adding @JsonCreator to a second constructor when one already exists. Using @JsonCreator on both a constructor and a static factory method that take the same parameter type. Library updates that change creator visibility rules exposing a previously hidden conflict.
Related errors
- Duplicate creator property "%s" (index %s vs %d) for type %s
- Cannot call createParameterObject() on {}
- Trying to resolve a forward reference with id [{}] that wasn
- Cannot call withValueDeserializer() on {}
- Cannot pass null property name
AI-assisted analysis of FasterXML/jackson-databind@a50c7d2a1d (2026-08-06).
Data as JSON: /api/errors/44e986e536b2f767.
Report an issue: GitHub.