{"record":{"id":"960238589a2e6c66","repo":"skylot/jadx","slug":"failed-to-expand-path","errorCode":null,"errorMessage":"Failed to expand path: {}","messagePattern":"Failed to expand path: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-gui/src/main/java/jadx/gui/cache/manager/CacheManager.java","lineNumber":187,"sourceCode":"\t}\n\n\tprivate String projectToKey(JadxProject project) {\n\t\tPath projectPath = project.getProjectPath();\n\t\tif (projectPath != null) {\n\t\t\treturn pathToString(projectPath);\n\t\t}\n\t\treturn \"tmp:\" + buildProjectUniqName(project);\n\t}\n\n\tprivate static String buildProjectUniqName(JadxProject project) {\n\t\treturn project.getName() + '-' + project.getInputsHash();\n\t}\n\n\tpublic static String pathToString(Path path) {\n\t\ttry {\n\t\t\treturn path.toAbsolutePath().normalize().toString();\n\t\t} catch (Exception e) {\n\t\t\tthrow new JadxRuntimeException(\"Failed to expand path: \" + path, e);\n\t\t}\n\t}\n\n\tprivate synchronized Map<String, CacheEntry> loadCaches() {\n\t\tList<CacheEntry> list = null;\n\t\tif (Files.exists(JadxFiles.CACHES_LIST)) {\n\t\t\ttry (BufferedReader reader = Files.newBufferedReader(JadxFiles.CACHES_LIST)) {\n\t\t\t\tlist = GSON.fromJson(reader, CACHES_TYPE);\n\t\t\t} catch (Exception e) {\n\t\t\t\tLOG.warn(\"Failed to load caches list\", e);\n\t\t\t}\n\t\t} else {\n\t\t\treturn initFromRecentProjects();\n\t\t}\n\t\tif (Utils.isEmpty(list)) {\n\t\t\treturn new HashMap<>();\n\t\t}\n\t\tMap<String, CacheEntry> map = new HashMap<>(list.size());","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-gui/src/main/java/jadx/gui/cache/manager/CacheManager.java#L169-L205","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// Before opening the project, validate the path:\nPath p = Path.of(inputString);\nif (!Files.exists(p)) {\n    throw new IllegalArgumentException(\"Input path does not exist: \" + inputString);\n}\n// Move to a shorter, ASCII-only path if on Windows.","handlingStrategy":"validation","validationCode":"// Validate path accessibility before cache key derivation\nPath abs = path.toAbsolutePath();\nif (!Files.exists(abs)) { throw new IllegalArgumentException(\"Path not accessible: \" + path); }\nString key = abs.normalize().toString();","typeGuard":"try {\n    path.toAbsolutePath().normalize();\n} catch (Exception e) {\n    // path is invalid on this filesystem\n}","tryCatchPattern":"try {\n    String key = CacheManager.pathToString(path);\n} catch (JadxRuntimeException e) {\n    LOG.warn(\"Cannot normalize path, using raw string\", e);\n    key = path.toString(); // fallback\n}","preventionTips":["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"],"tags":["cache","filesystem","path","platform-compat","jadx-gui"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}