zed-industries/zed · error
failed to determine XDG_CONFIG_HOME directory
Error message
failed to determine XDG_CONFIG_HOME directory
What it means
Panic on Linux/BSD when the computed XDG_CONFIG_HOME cannot be determined: the dirs-style lookup found neither a usable XDG_CONFIG_HOME env var nor a home directory (HOME unset and no passwd entry). This leaves no base path for ~/.config/zed, so config_dir construction aborts.
Source
Thrown at crates/paths/src/paths.rs:134
// 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() {
custom_dir.clone()
} else if cfg!(target_os = "macos") {
home_dir()
.join("Library/Application Support")
.join(APP_NAME)
} else if cfg!(any(target_os = "linux", target_os = "freebsd")) {View on GitHub (pinned to f4178619ac)
Solutions
- Set HOME or XDG_CONFIG_HOME to an absolute path in the environment
- If XDG_CONFIG_HOME is set, ensure it is absolute (relative values are invalid per the spec and are ignored)
- Propagate an error instead of panicking so callers can show guidance
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/paths/src/paths.rs:134 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/86638863c198f45d.
Report an issue: GitHub.