{"record":{"id":"72a131046a8ee6ad","repo":"gradle/gradle","slug":"cannot-convert-relative-path-s-to-an-absolute-fil","errorCode":null,"errorMessage":"Cannot convert relative path %s to an absolute file.","messagePattern":"Cannot convert relative path (.+?) to an absolute file\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"platforms/core-configuration/file-collections/src/main/java/org/gradle/api/internal/file/IdentityFileResolver.java","lineNumber":30,"sourceCode":" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.gradle.api.internal.file;\n\nimport java.io.File;\n\n/**\n * 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\n * can be known.\n *\n * NOTE: Do not create instances of this type. Instead, use the {@link FileLookup} service.\n */\npublic class IdentityFileResolver extends AbstractFileResolver {\n    @Override\n    protected File doResolve(File path) {\n        if (!path.isAbsolute()) {\n            throw new UnsupportedOperationException(String.format(\"Cannot convert relative path %s to an absolute file.\", path));\n        }\n        return path;\n    }\n\n    @Override\n    public String resolveAsRelativePath(Object path) {\n        throw new UnsupportedOperationException(String.format(\"Cannot convert path %s to a relative path.\", path));\n    }\n\n    @Override\n    public boolean canResolveRelativePath() {\n        return false;\n    }\n}\n","sourceCodeStart":12,"sourceCodeEnd":45,"githubUrl":"https://github.com/gradle/gradle/blob/534f27719b66953f95cc907aae7f2c1b12f5482d/platforms/core-configuration/file-collections/src/main/java/org/gradle/api/internal/file/IdentityFileResolver.java#L12-L45","documentation":"Gradle throws this error when the following condition is violated: Cannot convert relative path <value> to an absolute file.","triggerScenarios":"Thrown at platforms/core-configuration/file-collections/src/main/java/org/gradle/api/internal/file/IdentityFileResolver.java:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a value whose type matches the property type.","Convert the value explicitly (e.g. via map()) before assigning it to the property."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"534f27719b66953f95cc907aae7f2c1b12f5482d","analyzedAt":"2026-08-22T08:09:12.375Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}