apple/pkl · error · PklException
noResourceReaderRegistered
noResourceReaderRegistered
Error message
noResourceReaderRegistered
What it means
This evalError is thrown when Pkl code tries to read a resource from a local (file-backed) project dependency whose URI scheme has no registered ResourceReader in the ResourceManager. ResourceReaders resolves the dependency to a local URI, performs a security check, then asks the resource manager for a reader; a null reader means the scheme is unsupported (e.g. no reader registered for 'file' or a custom scheme). It is a configuration/evaluation-environment problem, not a data problem.
Source
Thrown at pkl-core/src/main/java/org/pkl/core/resource/ResourceReaders.java:556
@Override
public String getUriScheme() {
return "projectpackage";
}
@Override
public Optional<Object> read(URI uri)
throws IOException, URISyntaxException, SecurityManagerException {
var assetUri = new PackageAssetUri(uri);
var dependency = getProjectDepsResolver().getResolvedDependency(assetUri.getPackageUri());
var local = getLocalUri(dependency, assetUri);
if (local != null) {
var resourceManager = VmContext.get(null).getResourceManager();
var securityManager = VmContext.get(null).getSecurityManager();
securityManager.checkReadResource(local);
var reader = resourceManager.getResourceReader(local);
if (reader == null) {
throw new VmExceptionBuilder()
.evalError("noResourceReaderRegistered", uri.getScheme())
.build();
}
return resourceManager.doRead(reader, local, null);
}
var remoteDep = (Dependency.RemoteDependency) dependency;
var bytes = getPackageResolver().getBytes(assetUri, true, remoteDep.getChecksums());
return Optional.of(new Resource(uri, bytes));
}
@Override
public boolean hasHierarchicalUris() {
return true;
}
@Override
public boolean isGlobbable() {
return true;View on GitHub (pinned to f3efcbfc9b)
Solutions
- Register a ResourceReader for the missing scheme when building the evaluator (e.g. EvaluatorBuilder.resourceReaders / ResourceManager registration).
- Check the URI scheme of the resource being read; if it is a custom scheme, add the matching reader or switch the resource to a supported scheme (e.g. file/https).
- If embedding Pkl, verify the same reader set used by the CLI is attached to your EvaluatorBuilder.
Example fix
// before (embedded eval, no readers)
EvaluatorBuilder.withDefault();
// after
EvaluatorBuilder.withDefault()
.resourceReaders(new FileResourceReader()); Defensive patterns
Strategy: validation
Validate before calling
// in host code, before eval
var supported = Set.of("file", "https", "env", "projectpackage");
var scheme = URI.create(resourceUri).getScheme();
if (scheme == null || !supported.contains(scheme)) throw new IllegalArgumentException("no resource reader for scheme: " + scheme); Prevention
- Register all needed ResourceReaders on the EvaluatorBuilder before evaluation
- Mirror the CLI's reader configuration when embedding Pkl
- Log the scheme of any URI passed to read() during development
When it happens
Trigger: Calling `read(...)` on a resource whose resolved dependency URI has a scheme with no reader registered; occurs in the read path when getResourceReader(local) returns null right after securityManager.checkReadResource(local) succeeds.
Common situations: Running Pkl embedded with a custom evaluator that omitted a resource reader (e.g. file or a custom scheme reader); reading package resources under a scheme the host environment does not support; security manager allows the read but no reader plugin is installed.
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
- Node `%s` of type `%s` does not have a property named `%s`.
- JavaType token must be parameterized.
- Leaf node `%s` of type `%s` does not have a child named `%s`
- Node `%s` of type `%s` does not have a key named `%s`. Avail
- Did not find expected Java class `%s` on the classpath for P
AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08).
Data as JSON: /api/errors/1ef78be95cec3654.
Report an issue: GitHub.