{"record":{"id":"bb5a94eaa789a6a0","repo":"zed-industries/zed","slug":"failed-to-determine-xdg-cache-home-directory","errorCode":null,"errorMessage":"failed to determine XDG_CACHE_HOME directory","messagePattern":"failed to determine XDG_CACHE_HOME directory","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/paths/src/paths.rs","lineNumber":212,"sourceCode":"    static TEMP_DIR: OnceLock<PathBuf> = OnceLock::new();\n    TEMP_DIR.get_or_init(|| {\n        if cfg!(target_os = \"macos\") {\n            return dirs::cache_dir()\n                .expect(\"failed to determine cachesDirectory directory\")\n                .join(APP_NAME);\n        }\n\n        if cfg!(target_os = \"windows\") {\n            return dirs::cache_dir()\n                .expect(\"failed to determine LocalAppData directory\")\n                .join(APP_NAME);\n        }\n\n        if cfg!(any(target_os = \"linux\", target_os = \"freebsd\")) {\n            return if let Ok(flatpak_xdg_cache) = std::env::var(\"FLATPAK_XDG_CACHE_HOME\") {\n                flatpak_xdg_cache.into()\n            } else {\n                dirs::cache_dir().expect(\"failed to determine XDG_CACHE_HOME directory\")\n            }\n            .join(APP_NAME_LOWERCASE);\n        }\n\n        home_dir().join(\".cache\").join(APP_NAME_LOWERCASE)\n    })\n}\n\n/// Returns the path to the hang traces directory.\npub fn hang_traces_dir() -> &'static PathBuf {\n    static LOGS_DIR: OnceLock<PathBuf> = OnceLock::new();\n    LOGS_DIR.get_or_init(|| data_dir().join(\"hang_traces\"))\n}\n\n/// Returns the path to the logs directory.\npub fn logs_dir() -> &'static PathBuf {\n    static LOGS_DIR: OnceLock<PathBuf> = OnceLock::new();\n    LOGS_DIR.get_or_init(|| {","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/paths/src/paths.rs#L194-L230","documentation":"temp_dir() panics on the Linux/FreeBSD branch because the XDG_CACHE_HOME-derived cache dir lookup (dirs::cache_dir()) returned None, typically because HOME is unset or invalid in the environment launching Zed.","triggerScenarios":"Thrown at crates/paths/src/paths.rs:212 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set a valid HOME environment variable before launching Zed","Ensure XDG_CACHE_HOME points to a writable directory if overridden","Add a fallback to std::env::temp_dir() when dirs::cache_dir() is None"],"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"}