{"record":{"id":"236c17ca42e25eae","repo":"xpipe-io/xpipe","slug":"path-path-does-not-exist","errorCode":null,"errorMessage":"Path ${path} does not exist","messagePattern":"Path (.+?) does not exist","errorType":"exception","errorClass":"BeaconClientException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java","lineNumber":305,"sourceCode":"                        return builder.build();\n                    }\n                }))\n                .build();\n    }\n\n    public static McpServerFeatures.SyncToolSpecification getFileInfo() throws IOException {\n        var tool = McpSchemaFiles.loadTool(\"get_file_info.json\");\n        return McpServerFeatures.SyncToolSpecification.builder()\n                .tool(tool)\n                .callHandler(McpToolHandler.of((req) -> {\n                    var system = req.getStringArgument(\"system\");\n                    var shellStore = req.getShellStoreRef(system, false);\n                    var shellSession = AppBeaconServer.get().getCache().getOrStart(shellStore);\n                    var path = req.getFilePath(shellSession.getControl(), \"path\");\n                    var fs = new ShellFileSystem(shellSession.getControl());\n\n                    if (!fs.fileExists(path) && !fs.directoryExists(path)) {\n                        throw new BeaconClientException(\"Path \" + path + \" does not exist\");\n                    }\n\n                    var entry = fs.getFileInfo(path);\n                    if (entry.isEmpty()) {\n                        throw new BeaconClientException(\"Path \" + path + \" does not exist\");\n                    }\n\n                    var e = entry.get();\n                    var map = new LinkedHashMap<String, Object>();\n                    map.put(\"path\", e.getPath().toString());\n                    map.put(\"size\", e.getSize());\n                    if (e.getInfo() instanceof FileInfo.Unix u) {\n                        map.put(\"permissions\", u.getPermissions());\n                        map.put(\"user\", u.getUser());\n                        map.put(\"group\", u.getGroup());\n                    } else if (e.getInfo() instanceof FileInfo.Windows w) {\n                        map.put(\"attributes\", w.getAttributes());\n                    }","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java#L287-L323","documentation":"Thrown by the getFileInfo MCP tool when the requested path matches neither an existing file nor a directory on the target shell. The first check tests both fileExists() and directoryExists() before attempting to read metadata. A second identical throw happens if the metadata lookup itself returns empty.","triggerScenarios":"Calling getFileInfo with a 'path' argument that does not exist on the target system, or one that disappears between the exists-check and getFileInfo().","commonSituations":"Race where the file was removed by another process, symlink pointing to a missing target, wrong system selected, or case-sensitivity mismatches on Linux paths.","solutions":["Check the path exists via a shell listing before calling getFileInfo","Use an absolute path and match case exactly on Unix-like systems","Confirm the 'system' argument refers to the correct connection","Re-run the call if a concurrent process may have briefly removed the path"],"exampleFix":"// before\ngetFileInfo(system: \"host\", path: \"/etc/hosts.bak\") // non-existent\n// after\ngetFileInfo(system: \"host\", path: \"/etc/hosts\")","handlingStrategy":"validation","validationCode":"function assertPathExists(fs, path) {\n  if (!fs.fileExists(path) && !fs.directoryExists(path)) throw new Error(`Path ${path} does not exist`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await mcp.call('getFileInfo', {system, path});\n} catch (e) {\n  if (String(e.message).includes('does not exist')) return null; // treat as missing\n  throw e;\n}","preventionTips":["Match path case exactly on Unix","Avoid operating on files prone to concurrent deletion","Validate the path against a directory listing first"],"tags":["mcp","filesystem","path"],"backgroundTag":"file-not-found","analyzedSha":"d85ca821baa46092a320ebb13546d7240adb74f8","analyzedAt":"2026-09-06T14:30:08.251Z","contentChangedAt":"2026-09-06T14:30:08.251Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}