{"record":{"id":"515dfa129b3d7a8f","repo":"zed-industries/zed","slug":"failed-to-determine-cachesdirectory-directory","errorCode":null,"errorMessage":"failed to determine cachesDirectory directory","messagePattern":"failed to determine cachesDirectory directory","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/paths/src/paths.rs","lineNumber":198,"sourceCode":"                dirs::state_dir().expect(\"failed to determine XDG_STATE_HOME directory\")\n            }\n            .join(APP_NAME_LOWERCASE);\n        } else {\n            // Windows\n            return dirs::data_local_dir()\n                .expect(\"failed to determine LocalAppData directory\")\n                .join(APP_NAME);\n        }\n    })\n}\n\n/// Returns the path to the temp directory used by Zed.\npub fn temp_dir() -> &'static PathBuf {\n    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","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/paths/src/paths.rs#L180-L216","documentation":"temp_dir() panics while initializing the static temp path cache because dirs::cache_dir() (macOS branch, cachesDirectory) returned None. The OS could not locate the user's cache directory (e.g. missing/unresolvable HOME or XDG environment on that platform).","triggerScenarios":"Thrown at crates/paths/src/paths.rs:198 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the user environment resolves a cache directory (valid HOME on macOS, not running in a stripped environment)","Run Zed as a normal user session with standard macOS directory services","Wrap initialization to fall back to std::env::temp_dir() when dirs::cache_dir() returns 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-14T05:17:10.506Z"}