apple/pkl · error · PklException
e.getMessage()
Error message
e.getMessage()
What it means
Wraps a SecurityManagerException raised while checking the already-published package into a PklException with the raw exception message. This happens when the registry access check itself fails at a lower level (e.g. connection failure) rather than returning an HTTP status code.
Solutions
- Fix network connectivity / DNS to the registry host and retry the package command
- Check proxy settings (https_proxy) and TLS trust store if behind a corporate proxy
- Verify the registry URL in PklProject resolves correctly
Defensive patterns
Strategy: retry
Validate before calling
// preflight connectivity nslookup <registry-host> && curl -sI https://<registry-host> | head -1
Try / catch
catch (PklException e) { if (isNetworkMessage(e.getMessage())) { Thread.sleep(retryDelay); retryPackaging(); } else throw e; } Prevention
- Run packaging with network access guaranteed (no air-gapped CI without proxy config)
- Configure proxy/TLS settings explicitly in constrained environments
- Pin and verify registry hostnames
When it happens
Trigger: During checkAlreadyPublishedPackage, the SecurityManager-based fetch of the published package zip throws SecurityManagerException — e.g. network connection failure, DNS failure, or TLS error.
Common situations: No network access or offline CI machine; DNS misconfiguration; corporate TLS-intercepting proxy breaking certificate validation; wrong registry hostname.
Related errors
- errorConnectingToHost
- unableToAccessPublishedPackage
- badHttpStatusCode
- badHttpStatusCode
- errors.values.single().message ?: "An unexpected error…
AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08).
Data as JSON: /api/errors/9e2cb1ff61a9d071.
Report an issue: GitHub.
Appendix: source
Thrown at pkl-core/src/main/java/org/pkl/core/project/ProjectPackager.java:250
computedChecksum,
receivedChecksum));
}
} catch (PackageLoadError e) {
if (e.getMessageName().equals("badHttpStatusCode")) {
var firstArg = e.getArguments()[0];
assert firstArg != null;
var statusCode = (int) firstArg;
if (statusCode == 404) {
return;
} else {
throw new PklException(
ErrorMessages.create(
"unableToAccessPublishedPackage", pkg.name(), pkg.packageZipUrl(), statusCode));
}
}
throw e;
} catch (SecurityManagerException e) {
throw new PklException(e.getMessage());
}
}
private String createDependencyMetadataAndComputeChecksum(
Project project, Package pkg, Path metadataFile, String zipFileChecksum) throws IOException {
var dependencyMetadata = createDependencyMetadata(project, pkg, zipFileChecksum);
try (var fos = newDigestOutputStream(Files.newOutputStream((metadataFile)))) {
dependencyMetadata.writeTo(fos);
return ByteArrayUtils.toHex(fos.getMessageDigest().digest());
}
}
/** If the project has a local dependency, package it as well, so we can record its checksum. */
private Map<String, RemoteDependency> buildDependencies(Project project) throws IOException {
try {
var ret =
new HashMap<String, RemoteDependency>(
project.getDependencies().localDependencies().size()View on GitHub (pinned to f3efcbfc9b)