apple/pkl · error
'LOCALAPPDATA' is an invalid path
Error message
'LOCALAPPDATA' is an invalid path: {} What it means
Warning (not fatal) in ExecutorOptions.defaultModuleCacheDir: the LOCALAPPDATA environment variable is set but is not a valid path on this platform (InvalidPathException, e.g. containing NUL or illegal characters on Windows). The invalid value is logged and the code falls back to another cache directory; the input at fault is the LOCALAPPDATA environment variable.
Solutions
- Fix the LOCALAPPDATA environment variable to a valid Windows path.
- Unset LOCALAPPDATA so the default fallback location is used.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at pkl-executor/src/main/java/org/pkl/executor/ExecutorOptions.java:102 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08).
Data as JSON: /api/errors/f8319c9772d22eee.
Report an issue: GitHub.
Appendix: source
Thrown at pkl-executor/src/main/java/org/pkl/executor/ExecutorOptions.java:102
// depend on pkl-core).
//
// On Unix prefer the XDG-style `~/.cache/pkl`.
// On Windows prefer `%LOCALAPPDATA%/pkl/Cache`.
var xdgConfig = environmentVariables.get("XDG_CACHE_HOME");
if (xdgConfig != null && !xdgConfig.isEmpty()) {
try {
return Path.of(xdgConfig).resolve("pkl");
} catch (InvalidPathException e) {
logger.warn("'XDG_CACHE_HOME' is an invalid path: {}", e.getMessage());
}
}
if (isWindows) {
var localAppData = environmentVariables.get("LOCALAPPDATA");
if (localAppData != null && !localAppData.isEmpty()) {
try {
return Path.of(localAppData).resolve("pkl/Cache");
} catch (InvalidPathException e) {
logger.warn("'LOCALAPPDATA' is an invalid path: {}", e.getMessage());
}
}
}
return home.resolve(".cache/pkl");
}
private static boolean isWindowsOs() {
var osName = System.getProperty("os.name");
return osName != null && osName.toLowerCase(Locale.ROOT).contains("windows");
}
public static Builder builder() {
return new Builder();
}
/**
* A builder of {@link ExecutorOptions}.
*View on GitHub (pinned to f3efcbfc9b)