{"record":{"id":"54e41ad3d3703ea6","repo":"xpipe-io/xpipe","slug":"directory-msg-getpath-getparent-does-n","errorCode":null,"errorMessage":"Directory \" + msg.getPath().getParent() + \" does not exist","messagePattern":"Directory \" \\+ msg\\.getPath\\(\\)\\.getParent\\(\\) \\+ \" does not exist","errorType":"exception","errorClass":"BeaconClientException","httpStatus":400,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/beacon/api/FsWriteExchange.java","lineNumber":37,"sourceCode":"public 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\n        UUID store;\n\n        @NonNull\n        UUID blob;","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/beacon/api/FsWriteExchange.java#L19-L55","documentation":"Before writing, FsWriteExchange verifies that the parent directory of the target path exists on the remote filesystem via fs.directoryExists(). The daemon does not implicitly create directories, so writes into missing directories are rejected.","triggerScenarios":"Calling the fs write endpoint when msg.getPath().getParent() does not exist on the target store — e.g. writing to /opt/app/config.yaml before /opt/app exists, or after the directory was removed.","commonSituations":"First deployment to a fresh host where the app directory hasn't been created; typos in the parent directory; mounts not yet mounted when the write runs; Windows drive/path mismatches.","solutions":["Create the parent directory first (shell command mkdir -p or a directory-creation API call) then retry the write","Choose a target path inside an existing directory","Verify the parent path spelling and that mounts are active on the host","Use the parent-existence check client-side before uploading"],"exampleFix":"// before\nclient.writeFile(store, Path.of(\"/opt/app/config.yaml\"), blob);\n// after\nPath target = Path.of(\"/opt/app/config.yaml\");\nclient.mkdir(store, target.getParent());\nclient.writeFile(store, target, blob);","handlingStrategy":"validation","validationCode":"if (!client.directoryExists(store, target.getParent())) {\n    client.mkdir(store, target.getParent());\n}","typeGuard":null,"tryCatchPattern":"try {\n    client.writeFile(store, target, blob);\n} catch (BeaconClientException e) {\n    if (e.getMessage().startsWith(\"Directory \") && e.getMessage().endsWith(\"does not exist\")) {\n        client.mkdir(store, target.getParent());\n        client.writeFile(store, target, blob);\n    } else throw e;\n}","preventionTips":["Create parent directories as part of deployment","Verify mounts are active before writing to mounted paths","Treat directory creation as a prerequisite step, not implicit"],"tags":["beacon-api","filesystem","directory-not-found"],"backgroundTag":"directory-not-found","analyzedSha":"d85ca821baa46092a320ebb13546d7240adb74f8","analyzedAt":"2026-09-06T14:30:08.251Z","contentChangedAt":"2026-09-06T14:30:08.251Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}