{"record":{"id":"9e4a722122aaccfb","repo":"xpipe-io/xpipe","slug":"file-msg-getpath-does-not-exist","errorCode":null,"errorMessage":"File \" + msg.getPath() + \" does not exist","messagePattern":"File \" \\+ msg\\.getPath\\(\\) \\+ \" does not exist","errorType":"exception","errorClass":"BeaconClientException","httpStatus":400,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/beacon/api/FsReadExchange.java","lineNumber":41,"sourceCode":"public class FsReadExchange extends BeaconInterface<FsReadExchange.Request> {\n\n    @Override\n    public String getPath() {\n        return \"/fs/read\";\n    }\n\n    @Override\n    @SneakyThrows\n    public Object handle(HttpExchange exchange, Request msg) {\n        var shell = AppBeaconServer.get().getCache().getShellSession(msg.getStore());\n        var fs = new ShellFileSystem(shell.getControl());\n\n        if (!msg.getPath().isAbsolute()) {\n            throw new BeaconClientException(\"File path \" + msg.getPath() + \" is not absolute\");\n        }\n\n        if (!fs.fileExists(msg.getPath())) {\n            throw new BeaconClientException(\"File \" + msg.getPath() + \" does not exist\");\n        }\n\n        var size = fs.getFileSize(msg.getPath());\n        if (size > 100_000_000) {\n            var file = BlobManager.get().newBlobFile();\n            try (var in = fs.openInput(msg.getPath())) {\n                var fixedIn = new FixedSizeInputStream(new BufferedInputStream(in), size);\n                try (var fileOut = Files.newOutputStream(file)) {\n                    fixedIn.transferTo(fileOut);\n                }\n                in.transferTo(OutputStream.nullOutputStream());\n            }\n\n            exchange.sendResponseHeaders(200, size);\n            try (var fileIn = Files.newInputStream(file);\n                    var out = exchange.getResponseBody()) {\n                fileIn.transferTo(out);\n            }","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/beacon/api/FsReadExchange.java#L23-L59","documentation":"After validating the path is absolute, FsReadExchange checks fs.fileExists(path) on the remote shell filesystem. The requested file is not present at that location, so the daemon throws instead of opening a non-existent input stream.","triggerScenarios":"Calling the fs read endpoint with an absolute path that does not exist on the target store's filesystem — wrong machine, typo in the path, file deleted between listing and read, or case-sensitivity mismatch on Linux.","commonSituations":"Reading a config file assumed to exist on every host; stale cached file listings; reading Windows paths on a POSIX host or vice versa; race where a log file was rotated/deleted before the read.","solutions":["Verify the path exists (ls/stat on the target system or a prior fs listing call) before reading","Check spelling, case, and path separators against the target OS","Confirm the store id points at the machine you intended","Handle the error and retry after the file is created/rotated back"],"exampleFix":"// before\nbyte[] data = client.readFile(store, Path.of(\"/var/log/app.log\"));\n// after\nif (client.fileExists(store, Path.of(\"/var/log/app.log\"))) {\n    byte[] data = client.readFile(store, Path.of(\"/var/log/app.log\"));\n} else {\n    logger.warn(\"app.log missing on \" + store);\n}","handlingStrategy":"validation","validationCode":"if (!client.fileExists(store, path)) {\n    logger.warn(\"Skipping missing file: \" + path);\n    return null;\n}","typeGuard":null,"tryCatchPattern":"try {\n    return client.readFile(store, path);\n} catch (BeaconClientException e) {\n    if (e.getMessage().startsWith(\"File \") && e.getMessage().endsWith(\"does not exist\")) {\n        return null;\n    }\n    throw e;\n}","preventionTips":["Check existence (listing/stat) before reading","Mind case sensitivity on Linux hosts","Refresh cached file listings before reads","Confirm the store id points at the intended host"],"tags":["beacon-api","filesystem","file-not-found"],"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"}