{"record":{"id":"1b1bd9c9c2caeb03","repo":"apple/pkl","slug":"cannotresolvetripledotimports","errorCode":"cannotResolveTripleDotImports","errorMessage":"Cannot resolve a triple-dot import from module URI `{0}`.","messagePattern":"Cannot resolve a triple-dot import from module URI `(.+?)`\\.","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/util/IoUtils.java","lineNumber":376,"sourceCode":"  public static URI resolve(ReaderBase reader, URI baseUri, String importUri) {\n    return resolve(reader, baseUri, createUri(importUri));\n  }\n\n  public static URI resolve(ReaderBase reader, URI baseUri, URI importUri) {\n    if (reader.hasFragmentPaths() && !importUri.isAbsolute() && importUri.getPath() != null) {\n      var fragment = baseUri.getFragment();\n      var newFragment = resolve(createUri(fragment), importUri);\n      return stripFragment(baseUri).resolve(\"#\" + newFragment);\n    }\n    return resolve(baseUri, importUri);\n  }\n\n  private static URI resolveTripleDotImport(\n      SecurityManager securityManager, ModuleKey moduleKey, String tripleDotPath)\n      throws IOException, SecurityManagerException, ExternalReaderProcessException {\n    var moduleKeyUri = moduleKey.getUri();\n    if (!moduleKey.isLocal() || !moduleKey.hasHierarchicalUris()) {\n      throw new VmExceptionBuilder()\n          .evalError(\"cannotResolveTripleDotImports\", moduleKeyUri)\n          .build();\n    }\n    var currentPath =\n        moduleKey.hasFragmentPaths() ? moduleKeyUri.getFragment() : moduleKeyUri.getPath();\n    var effectiveImportPath =\n        tripleDotPath.isEmpty()\n            ? currentPath.substring(currentPath.lastIndexOf('/') + 1)\n            : tripleDotPath;\n\n    var index = currentPath.lastIndexOf('/');\n    index = currentPath.lastIndexOf('/', index - 1);\n    var basePath = currentPath;\n    while (index > 0) {\n      basePath = basePath.substring(0, index + 1);\n      var candidatePath = basePath + effectiveImportPath;\n      // make sure triple-dot cannot resolve to the same path.\n      var candidateUri = resolve(moduleKey, moduleKeyUri, candidatePath);","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/util/IoUtils.java#L358-L394","documentation":"Triple-dot imports (import \"...\") resolve relative to the enclosing project/package root. This eval error is thrown when the module performing the triple-dot import is not a local module with hierarchical URIs, so the '...' root cannot be computed.","triggerScenarios":"resolveTripleDotImport is invoked with a moduleKey that is remote (http:, package:, project:) or otherwise lacks hierarchical URIs, e.g. `import \"...\"` inside a module fetched from an HTTP URL or loaded from a package.","commonSituations":"Writing `import \".../foo.pkl\"` in a module that is itself loaded over http(s) or from a Pkl package, where relative filesystem resolution is impossible.","solutions":["Move the import so it is only used in local files on disk","Use a fully-qualified package or absolute URI import instead of triple-dot in remote modules","If the module should be local, load it via a file: URI"],"exampleFix":"// before (inside an http-served module)\nimport \".../my_module.pkl\"\n// after\nimport \"@my_package/my_module.pkl\"","handlingStrategy":"validation","validationCode":"if (importPath.startsWith(\"...\") && !moduleUri.getScheme().equals(\"file\")) {\n  throw new IllegalArgumentException(\"triple-dot import only valid in local modules\");\n}","typeGuard":"function supportsTripleDot(key) { return key.isLocal() && key.hasHierarchicalUris(); }","tryCatchPattern":"try { resolveTripleDotImport(...) } catch (VmException e) { logger.error(e.getMessage()); }","preventionTips":["Only use `import \"...\"` in modules on the local filesystem","Prefer package imports (@name) for remote modules","Keep triple-dot imports in project-local source trees"],"tags":["pkl","import","uri-resolution"],"backgroundTag":"unsupported-operation","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}