{"record":{"id":"efb47fb3bc40c8fb","repo":"apple/pkl","slug":"unsupported-value-of-type-notation-getclass-u","errorCode":null,"errorMessage":"Unsupported value of type ${notation.getClass()} used as a module path: ${notation}","messagePattern":"Unsupported value of type (.+?) used as a module path: (.+?)","errorType":"validation","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"pkl-gradle/src/main/java/org/pkl/gradle/utils/PluginUtils.java","lineNumber":109,"sourceCode":"    } else if (notation instanceof CharSequence) {\n      var s = notation.toString();\n      if (IoUtils.isUriLike(s)) {\n        try {\n          return parseModuleNotation(IoUtils.toUri(s));\n        } catch (URISyntaxException e) {\n          throw new InvalidUserDataException(\"Failed to parse Pkl module URI: \" + s, e);\n        }\n      } else {\n        try {\n          return Paths.get(s).toFile();\n        } catch (InvalidPathException | UnsupportedOperationException e) {\n          throw new InvalidUserDataException(\"Failed to parse Pkl module file path: \" + s, e);\n        }\n      }\n    } else if (notation instanceof FileSystemLocation location) {\n      return location.getAsFile();\n    } else {\n      throw new InvalidUserDataException(\n          \"Unsupported value of type \"\n              + notation.getClass()\n              + \" used as a module path: \"\n              + notation);\n    }\n  }\n\n  /**\n   * Converts either a file or a URI to a URI. We convert a relative file to a URI via the {@link\n   * IoUtils#createUri(String)} because other ways of conversion can make relative paths into\n   * absolute URIs, which may break module loading.\n   */\n  public static URI parsedModuleNotationToUri(Object notation) {\n    if (notation instanceof File file) {\n      if (file.isAbsolute()) {\n        return file.toPath().toUri();\n      }\n      return IoUtils.createUri(IoUtils.toNormalizedPathString(file.toPath()));","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-gradle/src/main/java/org/pkl/gradle/utils/PluginUtils.java#L91-L127","documentation":"parseModuleNotation only supports String, File, and FileSystemLocation notations. Any other object type reaches the final else branch and throws this InvalidUserDataException naming the actual class and value, so users know their module notation type is unsupported.","triggerScenarios":"Passing an unsupported object (e.g. a URI, Path, RegularFile, GString resolved late, Provider, or arbitrary object) where a module notation (String/File/FileSystemLocation) is expected in Pkl Gradle plugin configuration.","commonSituations":"Using project.uri(...) or files(...) results assigned into module properties without conversion, passing a Provider that was not unwrapped, or Kotlin/Gradle DSL type confusion when configuring the Pkl plugin.","solutions":["Convert the value: use toString() for URIs, .toFile() for Path, .asFile for RegularFile, or .get() for Provider","Use File or FileSystemLocation via project.objects/fileProperty APIs as the notation","Check the plugin's supported module notation types and match them in build scripts","If using lazy configuration, resolve with .get() before assigning or use the plugin's Property<FileSystemLocation>-typed accessors"],"exampleFix":"// before\npklModule = project.uri(\"https://example.com/x.pkl\")\n// after\npklModule = project.uri(\"https://example.com/x.pkl\").toString()","handlingStrategy":"type-guard","validationCode":"// before assigning a module notation:\nif (!(v instanceof String || v instanceof java.io.File || v instanceof org.gradle.api.file.FileSystemLocation)) {\n  throw new IllegalArgumentException(\"Unsupported module notation type: \" + v.getClass());\n}","typeGuard":"static boolean isSupportedModuleNotation(Object n) {\n  return n instanceof String || n instanceof java.io.File || n instanceof org.gradle.api.file.FileSystemLocation;\n}","tryCatchPattern":"try {\n  file = PluginUtils.parseModuleNotation(notation);\n} catch (InvalidUserDataException e) {\n  logger.error(\"Unsupported module notation: {}\", e.getMessage());\n  throw new GradleException(\"Convert notation to File/FileSystemLocation\", e);\n}","preventionTips":["Only assign String, File, or FileSystemLocation values to Pkl module properties","Unwrap Provider/RegularFile values with .get()/.asFile before assignment","Convert URI/Path objects explicitly (toString()/toFile())"],"tags":["gradle","type-error","unsupported-type","configuration"],"backgroundTag":"invalid-argument-value","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}