{"record":{"id":"7c34a53a96f44307","repo":"sinelaw/fresh","slug":"remote-home-directory-unknown","errorCode":null,"errorMessage":"remote home directory unknown","messagePattern":"remote home directory unknown","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/fresh-editor/src/services/remote/filesystem.rs","lineNumber":575,"sourceCode":"    }\n\n    fn remote_channel_id(&self) -> Option<u64> {\n        Some(self.channel.id())\n    }\n\n    fn remote_reconnect_notify(&self) -> Option<std::sync::Arc<tokio::sync::Notify>> {\n        Some(self.channel.reconnect_notify())\n    }\n\n    fn home_dir(&self) -> io::Result<PathBuf> {\n        // Served from the connect-time cache on the hot path (workspace\n        // restore / file open / file explorer), so the editor thread doesn't\n        // block; see `sys_info`. A remote that couldn't answer `info` never\n        // gets this far — the connect-time liveness gate (`prime_sys_info`)\n        // rejects it before the session is promoted.\n        self.sys_info()\n            .and_then(|info| info.home)\n            .ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, \"remote home directory unknown\"))\n    }\n\n    fn unique_temp_path(&self, dest_path: &Path) -> PathBuf {\n        // Use the remote system's temp directory instead of hardcoding /tmp,\n        // which doesn't exist on Windows remotes. Served from the connect-time\n        // cache when primed (see `sys_info`); falls back to /tmp if the info\n        // request fails (e.g. older agent without temp_dir support).\n        let temp_dir = self\n            .sys_info()\n            .map(|i| i.temp_dir)\n            .unwrap_or_else(|| PathBuf::from(\"/tmp\"));\n        let file_name = dest_path\n            .file_name()\n            .unwrap_or_else(|| std::ffi::OsStr::new(\"fresh-save\"));\n        let timestamp = std::time::SystemTime::now()\n            .duration_since(std::time::UNIX_EPOCH)\n            .map(|d| d.as_nanos())\n            .unwrap_or(0);","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/sinelaw/fresh/blob/67894ca5463dbd7a89bb31add4627c27d6b79d83/crates/fresh-editor/src/services/remote/filesystem.rs#L557-L593","documentation":"home_dir calls sys_info() and needs info.home; if the remote system info lacks a home directory (or the request failed) there is no reliable remote $HOME, so the adapter raises NotFound. The connect-time liveness gate normally guarantees sys_info was primed, so this indicates a remote that answered connect but reports no home.","triggerScenarios":"Calling home_dir() on a RemoteFileSystem whose sys_info response had home: null/absent, or whose sys_info() call now fails (remote degraded after connect).","commonSituations":"Remotes with restricted accounts or unusual environments (containers/service accounts without $HOME), custom agents that omit the home field in info, or a remote connection that went stale after the priming handshake.","solutions":["Ensure the remote agent reports a home directory in its info response; fix the remote account env (set $HOME) or update the agent.","Fall back to an explicit configured home/path in the editor settings instead of querying the remote.","Reconnect the remote session if it degraded after the connect-time prime_sys_info gate passed."],"exampleFix":"// before\nlet home = remote_fs.home_dir()?;\n// after\nlet home = remote_fs.home_dir().unwrap_or_else(|_| {\n    eprintln!(\"remote home unknown; using configured default\");\n    PathBuf::from(config.default_remote_home.as_deref().unwrap_or(\"/tmp\"))\n});","handlingStrategy":"fallback","validationCode":"let info = remote_fs.sys_info()?;\nif info.home.is_none() { eprintln!(\"remote did not report a home directory\"); }","typeGuard":"fn remote_home_known(info: &SysInfo) -> bool { info.home.as_deref().map(|h| !h.is_empty()).unwrap_or(false) }","tryCatchPattern":"let home = remote_fs.home_dir().unwrap_or_else(|_| {\n    config.remote_home.clone().unwrap_or_else(|| PathBuf::from(\"/tmp\"))\n});","preventionTips":["Ensure remote user accounts have $HOME set before connecting","Configure an explicit remote home/path in editor settings as a fallback","Require the connect-time sys_info prime to include a home field for the session to be promoted"],"tags":["remote","home-directory","env","configuration"],"backgroundTag":"missing-env-var","analyzedSha":"67894ca5463dbd7a89bb31add4627c27d6b79d83","analyzedAt":"2026-09-13T15:04:03.701Z","contentChangedAt":"2026-09-13T15:04:03.701Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}