LGUG2Z/komorebi · critical
there is no home directory
Error message
there is no home directory
What it means
While applying the bar theme in `try_apply_theme` (called from `apply_config` and `update`), komorebi-bar resolves its config home directory: it reads `KOMOREBI_CONFIG_HOME`, and if unset falls back to `dirs::home_dir()`. The expect `"there is no home directory"` panics when the fallback also fails, i.e. the OS gives no home directory for the current user.
Source
Thrown at komorebi-bar/src/bar.rs:635
};
}
fn try_apply_theme(&mut self, ctx: &Context) {
match &self.config.theme {
Some(theme) => {
apply_theme(
ctx,
theme.clone(),
self.bg_color.clone(),
self.bg_color_with_alpha.clone(),
self.config.transparency_alpha,
self.config.grouping,
self.render_config.clone(),
);
}
None => {
let home_dir: PathBuf = std::env::var("KOMOREBI_CONFIG_HOME").map_or_else(
|_| dirs::home_dir().expect("there is no home directory"),
|home_path| {
let home = home_path.replace_env();
assert!(
home.is_dir(),
"$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory"
);
home
},
);
let bar_transparency_alpha = self.config.transparency_alpha;
let bar_grouping = self.config.grouping;
let config = home_dir.join("komorebi.json");
match komorebi_client::StaticConfig::read(&config) {
Ok(config) => {View on GitHub (pinned to e0709f02bf)
Solutions
- Set `KOMOREBI_CONFIG_HOME` to a valid directory before launching the bar (e.g. `$Env:KOMOREBI_CONFIG_HOME = "$Env:USERPROFILE\.config\komorebi"`).
- Ensure `USERPROFILE` (Windows) or `HOME` (Unix) is set and points to an existing directory in the environment that starts the bar.
- Launch the bar from a normal user shell rather than a stripped service context, or pass the env vars explicitly to the process.
- Library-side: handle `dirs::home_dir()` returning None with an error message instead of an expect panic.
Example fix
// before
let home_dir: PathBuf = std::env::var("KOMOREBI_CONFIG_HOME").map_or_else(
|_| dirs::home_dir().expect("there is no home directory"),
|home_path| { /* ... */ },
);
// after
let home_dir: PathBuf = std::env::var("KOMOREBI_CONFIG_HOME").map_or_else(
|_| dirs::home_dir().ok_or_else(|| anyhow!("there is no home directory; set KOMOREBI_CONFIG_HOME"))?,
|home_path| { /* ... */ },
); Defensive patterns
Strategy: try-catch
Validate before calling
// check before starting the bar (PowerShell)
if (-not $Env:KOMOREBI_CONFIG_HOME -and -not $Env:USERPROFILE) {
throw "Neither KOMOREBI_CONFIG_HOME nor USERPROFILE is set; the bar cannot resolve a config home"
} Type guard
fn resolve_home_dir() -> Option<PathBuf> {
std::env::var_os("KOMOREBI_CONFIG_HOME")
.map(PathBuf::from)
.or_else(|| dirs::home_dir())
} Try / catch
// PowerShell wrapper that guarantees a home before launching
if (-not $Env:KOMOREBI_CONFIG_HOME) {
$Env:KOMOREBI_CONFIG_HOME = "$Env:USERPROFILE\.config\komorebi"
}
& komorebi-bar Prevention
- Always set KOMOREBI_CONFIG_HOME explicitly in your shell profile before launching the bar.
- Never launch the bar from stripped-environment contexts (services, schedulers) without exporting USERPROFILE/HOME.
- Sanity-check with `echo $Env:USERPROFILE` in the exact session used to start komorebi.
- Wrap the bar launch in a script that validates env vars first.
When it happens
Trigger: Running komorebi-bar with `KOMOREBI_CONFIG_HOME` unset AND `dirs::home_dir()` returning None — typically when the `USERPROFILE`/`HOME` environment variables are missing in the process environment (stripped env in services, scheduled tasks, or exotic launchers on Windows).
Common situations: Launching the bar from a service or task scheduler with a minimal environment, running inside a container or CI shell with no USERPROFILE, or corrupted user profile env vars so Windows cannot resolve a home directory.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- $Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is
- there is no home directory
- there is no home directory
- there is no home directory
- could not find home dir
AI-assisted analysis of LGUG2Z/komorebi@e0709f02bf (2026-09-06).
Data as JSON: /api/errors/300276e8edb0d4df.
Report an issue: GitHub.