apple/pkl · error · VmException

noModuleLoaderRegistered

noModuleLoaderRegistered

Error message

noModuleLoaderRegistered

What it means

After trying every registered ModuleKey factory, if none accepted the module URI, ModuleResolver throws eval error 'noModuleLoaderRegistered' naming the URI. It means no loader supports the URI's scheme.

Source

Thrown at pkl-core/src/main/java/org/pkl/core/runtime/ModuleResolver.java:103

            .withHint(e.getReason())
            .build();
      } catch (ExternalReaderProcessException e) {
        throw new VmExceptionBuilder()
            .withOptionalLocation(importNode)
            .evalError("externalReaderFailure")
            .withCause(e)
            .build();
      } catch (IOException e) {
        throw new VmExceptionBuilder()
            .withOptionalLocation(importNode)
            .evalError("ioErrorLoadingModule")
            .withCause(e)
            .build();
      }
      if (key.isPresent()) return key.get();
    }

    throw new VmExceptionBuilder()
        .evalError("noModuleLoaderRegistered", moduleUri)
        .withOptionalLocation(importNode)
        .build();
  }
}

View on GitHub (pinned to f3efcbfc9b)

Solutions

  1. Fix the URI scheme typo in the import statement (file:, https:, projectpackage:, etc.).
  2. If using a custom scheme, register the corresponding ModuleKey factory with the evaluator before evaluation.
  3. Verify project dependencies are resolved so 'projectpackage:' URIs are usable.

Example fix

// before
import "webcache://example.com/x.pkl"
// after
import "https://example.com/x.pkl"
Defensive patterns

Strategy: validation

Validate before calling

java.util.Set<String> supported = java.util.Set.of("file", "https", "http", "modulepath", "projectpackage", "repl");
if (!supported.contains(moduleUri.getScheme())) { /* reject or register a loader */ }

Try / catch

catch (VmException e) { if ("noModuleLoaderRegistered".equals(e.getCode())) { /* report unsupported scheme to user */ } }

Prevention

When it happens

Trigger: resolve() called with a URI whose scheme matches no registered module loader (factories all return Optional.empty()), e.g. 'ftp://...' or a typo'd custom scheme.

Common situations: Typos in import URIs ('fle:///x.pkl' instead of 'file://'), using a scheme that requires a dependency/extension not registered, custom module loaders not installed in embedded use.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08). Data as JSON: /api/errors/2894791ddeddc957. Report an issue: GitHub.