gradle/gradle · error · UnsupportedOperationException
Cannot convert path %s to a relative path.
Error message
Cannot convert path %s to a relative path.
What it means
Gradle throws this error when the following condition is violated: Cannot convert path <value> to a relative path.
Source
Thrown at platforms/core-configuration/file-collections/src/main/java/org/gradle/api/internal/file/IdentityFileResolver.java:37
/**
* FileResolver that uses the file provided to it or constructs one from the toString of the provided object. Used in cases where a FileResolver is needed by the infrastructure, but no base directory
* can be known.
*
* NOTE: Do not create instances of this type. Instead, use the {@link FileLookup} service.
*/
public class IdentityFileResolver extends AbstractFileResolver {
@Override
protected File doResolve(File path) {
if (!path.isAbsolute()) {
throw new UnsupportedOperationException(String.format("Cannot convert relative path %s to an absolute file.", path));
}
return path;
}
@Override
public String resolveAsRelativePath(Object path) {
throw new UnsupportedOperationException(String.format("Cannot convert path %s to a relative path.", path));
}
@Override
public boolean canResolveRelativePath() {
return false;
}
}
View on GitHub (pinned to 534f27719b)
Solutions
- Use a value whose type matches the property type.
- Convert the value explicitly (e.g. via map()) before assigning it to the property.
When it happens
Trigger: Thrown at platforms/core-configuration/file-collections/src/main/java/org/gradle/api/internal/file/IdentityFileResolver.java:37 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/371ea3c1d97c0af8.
Report an issue: GitHub.