xpipe-io/xpipe · error · BeaconClientException

File " + msg.getPath() + " does not exist

Error message

File " + msg.getPath() + " does not exist

What it means

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.

Source

Thrown at app/src/main/java/io/xpipe/app/beacon/api/FsReadExchange.java:41

public class FsReadExchange extends BeaconInterface<FsReadExchange.Request> {

    @Override
    public String getPath() {
        return "/fs/read";
    }

    @Override
    @SneakyThrows
    public Object handle(HttpExchange exchange, Request msg) {
        var shell = AppBeaconServer.get().getCache().getShellSession(msg.getStore());
        var fs = new ShellFileSystem(shell.getControl());

        if (!msg.getPath().isAbsolute()) {
            throw new BeaconClientException("File path " + msg.getPath() + " is not absolute");
        }

        if (!fs.fileExists(msg.getPath())) {
            throw new BeaconClientException("File " + msg.getPath() + " does not exist");
        }

        var size = fs.getFileSize(msg.getPath());
        if (size > 100_000_000) {
            var file = BlobManager.get().newBlobFile();
            try (var in = fs.openInput(msg.getPath())) {
                var fixedIn = new FixedSizeInputStream(new BufferedInputStream(in), size);
                try (var fileOut = Files.newOutputStream(file)) {
                    fixedIn.transferTo(fileOut);
                }
                in.transferTo(OutputStream.nullOutputStream());
            }

            exchange.sendResponseHeaders(200, size);
            try (var fileIn = Files.newInputStream(file);
                    var out = exchange.getResponseBody()) {
                fileIn.transferTo(out);
            }

View on GitHub (pinned to d85ca821ba)

Solutions

  1. Verify the path exists (ls/stat on the target system or a prior fs listing call) before reading
  2. Check spelling, case, and path separators against the target OS
  3. Confirm the store id points at the machine you intended
  4. Handle the error and retry after the file is created/rotated back

Example fix

// before
byte[] data = client.readFile(store, Path.of("/var/log/app.log"));
// after
if (client.fileExists(store, Path.of("/var/log/app.log"))) {
    byte[] data = client.readFile(store, Path.of("/var/log/app.log"));
} else {
    logger.warn("app.log missing on " + store);
}
Defensive patterns

Strategy: validation

Validate before calling

if (!client.fileExists(store, path)) {
    logger.warn("Skipping missing file: " + path);
    return null;
}

Try / catch

try {
    return client.readFile(store, path);
} catch (BeaconClientException e) {
    if (e.getMessage().startsWith("File ") && e.getMessage().endsWith("does not exist")) {
        return null;
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of xpipe-io/xpipe@d85ca821ba (2026-09-06). Data as JSON: /api/errors/9e4a722122aaccfb. Report an issue: GitHub.