{"record":{"id":"31274b3039fa6181","repo":"zed-industries/zed","slug":"failed-to-determine-roamingappdata-directory","errorCode":null,"errorMessage":"failed to determine RoamingAppData directory","messagePattern":"failed to determine RoamingAppData directory","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/paths/src/paths.rs","lineNumber":128,"sourceCode":"        let canonicalized = path\n            .canonicalize()\n            .expect(\"failed to canonicalize custom data directory's path to an absolute path\");\n        // On Windows, `canonicalize` produces extended-length paths prefixed\n        // with `\\\\?\\`. Strip that prefix so downstream consumers (e.g.\n        // Node.js language servers) that receive derived paths as arguments\n        // don't choke on the verbatim syntax.\n        SanitizedPath::new(&canonicalized).as_path().to_path_buf()\n    })\n}\n\n/// Returns the path to the configuration directory used by Zed.\npub fn config_dir() -> &'static PathBuf {\n    CONFIG_DIR.get_or_init(|| {\n        if let Some(custom_dir) = CUSTOM_DATA_DIR.get() {\n            custom_dir.join(\"config\")\n        } else if cfg!(target_os = \"windows\") {\n            dirs::config_dir()\n                .expect(\"failed to determine RoamingAppData directory\")\n                .join(APP_NAME)\n        } else if cfg!(any(target_os = \"linux\", target_os = \"freebsd\")) {\n            if let Ok(flatpak_xdg_config) = std::env::var(\"FLATPAK_XDG_CONFIG_HOME\") {\n                flatpak_xdg_config.into()\n            } else {\n                dirs::config_dir().expect(\"failed to determine XDG_CONFIG_HOME directory\")\n            }\n            .join(APP_NAME_LOWERCASE)\n        } else {\n            home_dir().join(\".config\").join(APP_NAME_LOWERCASE)\n        }\n    })\n}\n\n/// Returns the path to the data directory used by Zed.\npub fn data_dir() -> &'static PathBuf {\n    CURRENT_DATA_DIR.get_or_init(|| {\n        if let Some(custom_dir) = CUSTOM_DATA_DIR.get() {","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/paths/src/paths.rs#L110-L146","documentation":"Panic on Windows when dirs::config_dir() (RoamingAppData) returns None while computing the config directory. The dirs crate yields None when the FOLDERID_RoamingAppData known folder cannot be resolved — usually a broken shell-folder registry value or an unusual Windows environment — leaving Zed without a base config path.","triggerScenarios":"Thrown at crates/paths/src/paths.rs:128 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the Roaming AppData shell folder is resolvable (check HKCU ... User Shell Folders / run `echo %APPDATA%`)","Set ZED_CUSTOM_DATA_DIR (set_custom_data_dir) to bypass platform detection","Fall back to the local app data or home directory instead of panicking when RoamingAppData is unavailable"],"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"}