{"record":{"id":"daf7d8929e393292","repo":"apple/pkl","slug":"cannotgloburi-daf7d8","errorCode":"cannotGlobUri","errorMessage":"cannotGlobUri","messagePattern":"cannotGlobUri","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java","lineNumber":1190,"sourceCode":"          .build();\n    }\n\n    var isGlob = (Boolean) VmUtils.readMember(mport, Identifier.GLOB);\n    var importUri = URI.create(uriString);\n    var language = VmLanguage.get(null);\n\n    // non-glob\n    if (!isGlob) {\n      var moduleKey = moduleResolver.resolve(importUri);\n      return language.loadModule(moduleKey);\n    }\n\n    // glob\n    var globModuleKey = moduleResolver.resolve(importUri);\n\n    try {\n      if (!globModuleKey.isGlobbable()) {\n        throw exceptionBuilder()\n            .evalError(\"cannotGlobUri\", importUri, importUri.getScheme())\n            .build();\n      }\n      var resolvedElements =\n          GlobResolver.resolveGlob(securityManager, globModuleKey, null, null, uriString);\n\n      var builder = new VmObjectBuilder(resolvedElements.size());\n      for (var entry : resolvedElements.entrySet()) {\n        var moduleKey = moduleResolver.resolve(entry.getValue().uri());\n        builder.addEntry(entry.getKey(), language.loadModule(moduleKey));\n      }\n      return builder.toMapping(resolvedElements);\n    } catch (IOException e) {\n      throw exceptionBuilder().evalError(\"ioErrorResolvingGlob\", importUri).withCause(e).build();\n    } catch (ExternalReaderProcessException e) {\n      throw exceptionBuilder().evalError(\"externalReaderFailure\").withCause(e).build();\n    } catch (SecurityManagerException e) {\n      throw exceptionBuilder().withCause(e).build();","sourceCodeStart":1172,"sourceCodeEnd":1208,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java#L1172-L1208","documentation":"Thrown when an import marked as a glob (isGlob = true) resolves to a URI whose scheme/module key does not support globbing. Glob resolution expands a wildcard pattern into multiple modules, which only scheme handlers whose module key `isGlobbable()` (e.g. file, project resources) can do; schemes like http(s), env, or custom external readers are rejected with the URI and its scheme in the message.","triggerScenarios":"Writing `uri = \"https://example.com/*.pkl\"; glob = true` (or `env://.../*.pkl`) in an import entry — after resolving the URI, globModuleKey.isGlobbable() returns false and handleImport throws.","commonSituations":"Adding `glob = true` to a remote HTTP import; assuming globs work over env/other schemes; moving a working local glob import to a hosted URL without removing glob.","solutions":["Remove `glob = true` and enumerate the imports explicitly","Switch to a globbable scheme (e.g. local file paths) if wildcard expansion is needed","Fetch the remote files locally (or use a project/resolver that supports globs) and glob over the local paths"],"exampleFix":"// before\nnew Import { uri = \"https://example.com/*.pkl\"; glob = true }\n\n// after\nnew Import { uri = \"file://./modules/*.pkl\"; glob = true }","handlingStrategy":"validation","validationCode":"// only mark globs on schemes that support them\nconst GLOBBABLE_SCHEMES = [\"file\", \"untitled\"]\nfunction canGlob(uri: String): Boolean =\n  uri.startsWith(\"/\") || GLOBBABLE_SCHEMES.any((s) -> uri.startsWith(s + \"://\"))","typeGuard":"function isGlobbableImport(uri: String, glob: Boolean): Boolean =\n  !glob || uri.startsWith(\"file://\") || uri.startsWith(\"/\")","tryCatchPattern":null,"preventionTips":["Only set glob = true on local file (or project resource) URIs","Enumerate remote imports explicitly instead of globbing over http(s)/env schemes","Test glob imports locally before pointing them at other schemes"],"tags":["pkl","glob","import","unsupported-scheme"],"backgroundTag":"unsupported-operation","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}