{"record":{"id":"06c9454a6c1fc3d2","repo":"xpipe-io/xpipe","slug":"file-path-msg-getpath-is-not-absolute-06c945","errorCode":null,"errorMessage":"File path \" + msg.getPath() + \" is not absolute","messagePattern":"File path \" \\+ msg\\.getPath\\(\\) \\+ \" is not absolute","errorType":"exception","errorClass":"BeaconClientException","httpStatus":400,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/beacon/api/FsWriteExchange.java","lineNumber":33,"sourceCode":"import lombok.extern.jackson.Jacksonized;\n\nimport java.util.UUID;\n\npublic class FsWriteExchange extends BeaconInterface<FsWriteExchange.Request> {\n\n    @Override\n    public String getPath() {\n        return \"/fs/write\";\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.directoryExists(msg.getPath().getParent())) {\n            throw new BeaconClientException(\"Directory \" + msg.getPath().getParent() + \" does not exist\");\n        }\n\n        try (var in = BlobManager.get().getBlob(msg.getBlob());\n                var os = fs.openOutput(msg.getPath(), BlobManager.get().getSize(msg.getBlob()))) {\n            in.transferTo(os);\n        }\n        return Response.builder().build();\n    }\n\n    @Jacksonized\n    @Builder\n    @Value\n    public static class Request {\n        @NonNull","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/beacon/api/FsWriteExchange.java#L15-L51","documentation":"FsWriteExchange requires an absolute target path for the file being written. A relative path cannot be resolved reliably on the remote shell filesystem, so the daemon rejects the request before performing any I/O.","triggerScenarios":"Calling the fs write endpoint with msg.getPath() relative (e.g. 'out.bin'), usually from code that built the path from a working directory assumption or a truncated config value.","commonSituations":"Uploading files with user-supplied relative names; reusing read-side paths that happened to be relative; templated scripts where the base directory variable was empty, leaving 'sub/file' instead of '/base/sub/file'.","solutions":["Resolve the path to absolute on the client before calling (baseDir.resolve(name).normalize())","Anchor writes to a known absolute directory on the remote host","Validate path.isAbsolute() client-side and fail early with a clearer message","For Windows targets, include the drive letter (e.g. 'C:\\\\temp\\\\out.bin')"],"exampleFix":"// before\nclient.writeFile(store, Path.of(\"out.bin\"), blob);\n// after\nPath target = remoteBaseDir.resolve(\"out.bin\").normalize();\nif (!target.isAbsolute()) throw new IllegalArgumentException(\"target must be absolute\");\nclient.writeFile(store, target, blob);","handlingStrategy":"validation","validationCode":"Path target = baseDir.resolve(name).normalize();\nif (!target.isAbsolute()) {\n    throw new IllegalArgumentException(\"Write target must be absolute: \" + target);\n}","typeGuard":"boolean isAbsoluteWriteTarget(Path p) {\n    return p != null && p.isAbsolute() && p.getParent() != null;\n}","tryCatchPattern":"try {\n    client.writeFile(store, path, blob);\n} catch (BeaconClientException e) {\n    if (e.getMessage().contains(\"is not absolute\")) {\n        client.writeFile(store, remoteRoot.resolve(path).normalize(), blob);\n    } else throw e;\n}","preventionTips":["Build write paths from an explicit remote base directory","Include drive letters for Windows targets","Validate absoluteness client-side before every write"],"tags":["beacon-api","filesystem","path-validation"],"backgroundTag":"invalid-argument-value","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"}