skylot/jadx · error · JadxRuntimeException
Failed to expand path: {}
Error message
Failed to expand path: {} What it means
CacheManager.pathToString converts a Path to an absolute, normalized string. If toAbsolutePath().normalize() fails — typically due to an InvalidPathException or IOError from the filesystem provider — the exception is wrapped in a JadxRuntimeException naming the problematic path.
Source
Thrown at jadx-gui/src/main/java/jadx/gui/cache/manager/CacheManager.java:187
}
private String projectToKey(JadxProject project) {
Path projectPath = project.getProjectPath();
if (projectPath != null) {
return pathToString(projectPath);
}
return "tmp:" + buildProjectUniqName(project);
}
private static String buildProjectUniqName(JadxProject project) {
return project.getName() + '-' + project.getInputsHash();
}
public static String pathToString(Path path) {
try {
return path.toAbsolutePath().normalize().toString();
} catch (Exception e) {
throw new JadxRuntimeException("Failed to expand path: " + path, e);
}
}
private synchronized Map<String, CacheEntry> loadCaches() {
List<CacheEntry> list = null;
if (Files.exists(JadxFiles.CACHES_LIST)) {
try (BufferedReader reader = Files.newBufferedReader(JadxFiles.CACHES_LIST)) {
list = GSON.fromJson(reader, CACHES_TYPE);
} catch (Exception e) {
LOG.warn("Failed to load caches list", e);
}
} else {
return initFromRecentProjects();
}
if (Utils.isEmpty(list)) {
return new HashMap<>();
}
Map<String, CacheEntry> map = new HashMap<>(list.size());View on GitHub (pinned to e738a26571)
Solutions
- Verify the input file path is valid and accessible on the current OS
- Ensure removable/network drives are mounted before opening the project
- Enable Windows long path support if paths exceed 260 characters
- Move the project to a simpler, shorter path without special characters
Example fix
// Before opening the project, validate the path:
Path p = Path.of(inputString);
if (!Files.exists(p)) {
throw new IllegalArgumentException("Input path does not exist: " + inputString);
}
// Move to a shorter, ASCII-only path if on Windows. Defensive patterns
Strategy: validation
Validate before calling
// Validate path accessibility before cache key derivation
Path abs = path.toAbsolutePath();
if (!Files.exists(abs)) { throw new IllegalArgumentException("Path not accessible: " + path); }
String key = abs.normalize().toString(); Type guard
try {
path.toAbsolutePath().normalize();
} catch (Exception e) {
// path is invalid on this filesystem
} Try / catch
try {
String key = CacheManager.pathToString(path);
} catch (JadxRuntimeException e) {
LOG.warn("Cannot normalize path, using raw string", e);
key = path.toString(); // fallback
} Prevention
- Ensure all input paths are valid and accessible on the host OS
- Enable long path support on Windows
- Avoid special characters in input file paths
When it happens
Trigger: pathToString() calls path.toAbsolutePath().normalize().toString(). On some platforms or with unusual path characters, the underlying FileSystemProvider can throw. Used internally as a cache key derivation step.
Common situations: Path contains characters invalid for the host filesystem. Path on a removable or network drive that is no longer mounted. Path constructed from a malformed string. Windows paths exceeding MAX_PATH without long-path support enabled.
Related errors
- Failed to write metadata file
- Failed to reset code cache
- Failed to remove code cache for {}
- Failed to enumerate cached classes
- Failed to write caches file
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/960238589a2e6c66.
Report an issue: GitHub.