zed-industries/zed · error
failed to determine RoamingAppData directory
Error message
failed to determine RoamingAppData directory
What it means
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.
Source
Thrown at crates/paths/src/paths.rs:128
let canonicalized = path
.canonicalize()
.expect("failed to canonicalize custom data directory's path to an absolute path");
// On Windows, `canonicalize` produces extended-length paths prefixed
// with `\\?\`. Strip that prefix so downstream consumers (e.g.
// Node.js language servers) that receive derived paths as arguments
// don't choke on the verbatim syntax.
SanitizedPath::new(&canonicalized).as_path().to_path_buf()
})
}
/// Returns the path to the configuration directory used by Zed.
pub fn config_dir() -> &'static PathBuf {
CONFIG_DIR.get_or_init(|| {
if let Some(custom_dir) = CUSTOM_DATA_DIR.get() {
custom_dir.join("config")
} else if cfg!(target_os = "windows") {
dirs::config_dir()
.expect("failed to determine RoamingAppData directory")
.join(APP_NAME)
} else if cfg!(any(target_os = "linux", target_os = "freebsd")) {
if let Ok(flatpak_xdg_config) = std::env::var("FLATPAK_XDG_CONFIG_HOME") {
flatpak_xdg_config.into()
} else {
dirs::config_dir().expect("failed to determine XDG_CONFIG_HOME directory")
}
.join(APP_NAME_LOWERCASE)
} else {
home_dir().join(".config").join(APP_NAME_LOWERCASE)
}
})
}
/// Returns the path to the data directory used by Zed.
pub fn data_dir() -> &'static PathBuf {
CURRENT_DATA_DIR.get_or_init(|| {
if let Some(custom_dir) = CUSTOM_DATA_DIR.get() {View on GitHub (pinned to f4178619ac)
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
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/paths/src/paths.rs:128 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/31274b3039fa6181.
Report an issue: GitHub.