{"record":{"id":"345074f5a6b38b5b","repo":"apple/pkl","slug":"cannotresolveinlocaldependencynotglobbablenorlocal","errorCode":"cannotResolveInLocalDependencyNotGlobbableNorLocal","errorMessage":"cannotResolveInLocalDependencyNotGlobbableNorLocal","messagePattern":"cannotResolveInLocalDependencyNotGlobbableNorLocal","errorType":"error_code","errorClass":"PackageLoadError","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/module/ModuleKeys.java","lineNumber":780,"sourceCode":"        return moduleKey.listElements(securityManager, local);\n      }\n      var dep = (Dependency.RemoteDependency) dependency;\n      assert dep.getChecksums() != null;\n      return getPackageResolver().listElements(packageAssetUri, dep.getChecksums());\n    }\n\n    @Override\n    public boolean hasElement(SecurityManager securityManager, URI elementUri)\n        throws IOException, SecurityManagerException, ExternalReaderProcessException {\n      securityManager.checkResolveModule(elementUri);\n      var packageAssetUri = PackageAssetUri.create(elementUri);\n      var dependency =\n          getProjectDependenciesManager().getResolvedDependency(packageAssetUri.getPackageUri());\n      var local = getLocalUri(dependency, packageAssetUri);\n      if (local != null) {\n        var moduleKey = VmContext.get(null).getModuleResolver().resolve(local);\n        if (!moduleKey.isGlobbable() && !moduleKey.isLocal()) {\n          throw new PackageLoadError(\n              \"cannotResolveInLocalDependencyNotGlobbableNorLocal\", local.getScheme());\n        }\n        return moduleKey.hasElement(securityManager, local);\n      }\n      var dep = (Dependency.RemoteDependency) dependency;\n      assert dep.getChecksums() != null;\n      return getPackageResolver().hasElement(packageAssetUri, dep.getChecksums());\n    }\n\n    @Override\n    protected Map<String, ? extends Dependency> getDependencies()\n        throws IOException, SecurityManagerException {\n      var packageUri = packageAssetUri.getPackageUri();\n      var projectResolver = getProjectDependenciesManager();\n      if (projectResolver.isLocalPackage(packageUri)) {\n        return projectResolver.getLocalPackageDependencies(packageUri);\n      }\n      var dep =","sourceCodeStart":762,"sourceCodeEnd":798,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/module/ModuleKeys.java#L762-L798","documentation":"Similar to error 130 but on the has-element path: when checking whether an element exists inside a local package dependency, the resolved module key must either support globbing or be a local (filesystem-backed) key. If the resolved key is neither globbable nor local, Pkl throws this PackageLoadError because it cannot interrogate the element's existence through that scheme.","triggerScenarios":"Calling the hasElement path for a package-asset URI backed by a LocalDependency where ModuleResolver.resolve(local) returns a key with isGlobbable() == false AND isLocal() == false, e.g. a remote or virtual scheme used as a local dependency target.","commonSituations":"A local dependency URI resolving to a non-filesystem scheme (custom module path entry, virtual scheme), so membership checks on package elements fail; typically a misconfigured local dependency or custom module path scheme.","solutions":["Point the local dependency at a filesystem (file:// or relative path) URI so the resolved key is local.","If glob support is intended, use a scheme whose module key implements isGlobbable() = true.","Fix the local-URI mapping (getLocalUri) so it never yields a remote/virtual scheme for local dependencies.","In custom ModuleKey implementations, ensure isLocal() or isGlobbable() is true and hasElement() is supported."],"exampleFix":"// before: local dep resolving to remote-scheme URI\n\"local\": \"https://example.com/mypkg\"\n// after: local dep resolving to a filesystem path\n\"local\": \"file:///workspace/mypkg\"","handlingStrategy":"validation","validationCode":"// before checking element existence via a local dependency, verify the resolved key is usable\nvar resolved = moduleResolver.resolve(localUri);\nboolean usable = resolved.isGlobbable() || resolved.isLocal();\nif (!usable) throw new IllegalStateException(\"Scheme \" + localUri.getScheme() + \" is neither globbable nor local\");","typeGuard":"boolean isLocalOrGlobbable(ModuleKey key) {\n  return key.isLocal() || key.isGlobbable();\n}","tryCatchPattern":"try {\n  has = key.hasElement(securityManager, local);\n} catch (PackageLoadError e) {\n  if (e.getMessage().contains(\"not globbable and is not local\")) {\n    throw new IllegalArgumentException(\"Cannot query elements through scheme \" + local + \"; use a filesystem-backed local dependency\", e);\n  }\n  throw e;\n}","preventionTips":["Use filesystem-backed URIs for local dependencies in PklProject.deps.json.","Do not map local dependencies to remote/virtual schemes via custom resolvers.","For custom ModuleKeys, ensure hasElement() is implemented and isLocal()/isGlobbable() returns true.","Validate local dependency URIs at project configuration time, not at import time."],"tags":["pkl","dependency-resolution","local-dependency","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-14T16:17:12.679Z"}