{"record":{"id":"ca146f20eec8136f","repo":"zed-industries/zed","slug":"failed-to-determine-home-directory","errorCode":null,"errorMessage":"failed to determine home directory","messagePattern":"failed to determine home directory","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/util/src/paths.rs","lineNumber":36,"sourceCode":"use path::rel_path::RelPathBuf;\n\npub use path::PathStyle;\n\n/// Returns the path to the user's home directory.\n#[cfg(not(target_family = \"wasm\"))]\npub fn home_dir() -> &'static PathBuf {\n    static HOME_DIR: std::sync::OnceLock<PathBuf> = std::sync::OnceLock::new();\n    HOME_DIR.get_or_init(|| {\n        if cfg!(any(test, feature = \"test-support\")) {\n            if cfg!(target_os = \"macos\") {\n                PathBuf::from(\"/Users/zed\")\n            } else if cfg!(target_os = \"windows\") {\n                PathBuf::from(\"C:\\\\Users\\\\zed\")\n            } else {\n                PathBuf::from(\"/home/zed\")\n            }\n        } else {\n            dirs::home_dir().expect(\"failed to determine home directory\")\n        }\n    })\n}\n\npub trait PathExt {\n    /// Compacts a given file path by replacing the user's home directory\n    /// prefix with a tilde (`~`).\n    ///\n    /// # Returns\n    ///\n    /// * A `PathBuf` containing the compacted file path. If the input path\n    ///   does not have the user's home directory prefix, or if we are not on\n    ///   Linux or macOS, the original path is returned unchanged.\n    fn compact(&self) -> PathBuf;\n\n    /// Returns a file's extension or, if the file is hidden, its name without the leading dot\n    fn extension_or_hidden_file_name(&self) -> Option<&str>;\n","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/util/src/paths.rs#L18-L54","documentation":"home_dir() panics caching the home directory because dirs::home_dir() returned None — the process environment has no resolvable home directory (missing HOME/USERPROFILE), typically from running in a stripped or service environment.","triggerScenarios":"Thrown at crates/util/src/paths.rs:36 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set HOME (Unix) or USERPROFILE (Windows) before launching","Fall back to std::env::temp_dir()-based path when home is unresolvable","Avoid running Zed in environments without a user home"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}