gradle/gradle · error · IllegalStateException
Unexpected convention-supporting type %s used in property %s
Error message
Unexpected convention-supporting type %s used in property %s.%s
What it means
Gradle throws this error when the following condition is violated: Unexpected convention-supporting type <value> used in property <value>.<value>
Source
Thrown at platforms/core-configuration/model-core/src/main/java/org/gradle/internal/extensibility/ConventionAwareHelper.java:94
String renamedProperty = ProviderApiMigrationConventionHelper.findRenamedProperty(sourceType, propertyName);
if (renamedProperty != null) {
propertyName = renamedProperty;
}
if (_ineligiblePropertyNames.contains(propertyName)) {
Method getter = JavaPropertyReflectionUtil.findGetterMethod(sourceType, propertyName);
// When there's a convention-supporting object, use its `.convention()` method instead
// This is something we added to support properties migrated in the future from
// Java bean to Property where old code uses ConventionMapping to set conventions.
if (getter != null && SupportsConvention.class.isAssignableFrom(getter.getReturnType())) {
SupportsConvention target;
try {
target = Cast.uncheckedNonnullCast(getter.invoke(_source));
} catch (IllegalAccessException | InvocationTargetException e) {
throw new IllegalStateException(String.format("Could not access property %s.%s", sourceType.getSimpleName(), propertyName), e);
}
if (!mapConventionOn(target, mapping)) {
throw new IllegalStateException(String.format(
"Unexpected convention-supporting type %s used in property %s.%s", getter.getReturnType().getName(), sourceType.getSimpleName(), propertyName));
}
} else {
throw DocumentedFailure.builder()
.withSummary("Using internal convention mapping with a Provider backed property.")
.withUpgradeGuideSection(7, "convention_mapping")
.build();
}
} else {
_mappings.put(propertyName, mapping);
}
return mapping;
}
private boolean mapConventionOn(SupportsConvention target, MappedPropertyImpl mapping) {
if (target instanceof FileSystemLocationProperty) {
FileSystemLocationPropertyInternal<?> asFileSystemLocationProperty = Cast.uncheckedNonnullCast(target);
asFileSystemLocationProperty.conventionFromAnyFile(new DefaultProvider<>(() -> mapping.getValue()));View on GitHub (pinned to 534f27719b)
Solutions
- Review the values passed to this API and correct the invalid input described in the error message.
When it happens
Trigger: Thrown at platforms/core-configuration/model-core/src/main/java/org/gradle/internal/extensibility/ConventionAwareHelper.java:94 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gradle/gradle@534f27719b (2026-08-22).
Data as JSON: /api/errors/0cbdd94c61334ac8.
Report an issue: GitHub.