LGUG2Z/komorebi · critical
there is no home directory
Error message
there is no home directory
What it means
In komorebi-bar's `main`, before the bar starts, the config home directory is resolved the same way as in the bar module: `KOMOREBI_CONFIG_HOME` is read, falling back to `dirs::home_dir()` with `.expect("there is no home directory")`. This panics at startup when neither the env var nor the OS home directory can be resolved, preventing the process from starting at all.
Source
Thrown at komorebi-bar/src/main.rs:169
}
}
color_eyre::install()?;
if std::env::var("RUST_LOG").is_err() {
unsafe {
std::env::set_var("RUST_LOG", "info");
}
}
tracing::subscriber::set_global_default(
tracing_subscriber::fmt::Subscriber::builder()
.with_env_filter(EnvFilter::from_default_env())
.finish(),
)?;
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
},
);
if opts.quickstart {
let komorebi_bar_json = include_str!("../../docs/komorebi.bar.example.json").to_string();
std::fs::write(home_dir.join("komorebi.bar.json"), komorebi_bar_json)?;
println!(
"Example komorebi.bar.json file written to {}",
home_dir.display()View on GitHub (pinned to e0709f02bf)
Solutions
- Set `KOMOREBI_CONFIG_HOME` to a valid directory before invoking the binary (e.g. `$Env:KOMOREBI_CONFIG_HOME = "$Env:USERPROFILE\.config\komorebi"`).
- Ensure `USERPROFILE` (Windows) or `HOME` (Unix) is present and correct in the launching environment.
- Launch the bar from a regular user shell / via the documented komorebi startup path rather than a bare service context.
- Library-side: return a startup error instead of an expect panic so users get an actionable message.
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 to your komorebi config directory")
})?,
|home_path| { /* ... */ },
); Defensive patterns
Strategy: try-catch
Validate before calling
// check before invoking the binary (PowerShell)
if (-not $Env:KOMOREBI_CONFIG_HOME -and -not $Env:USERPROFILE) {
throw "No home directory resolvable: set KOMOREBI_CONFIG_HOME or USERPROFILE"
} Type guard
fn has_resolvable_home() -> bool {
std::env::var_os("KOMOREBI_CONFIG_HOME").is_some() || dirs::home_dir().is_some()
} Try / catch
# launch wrapper that supplies a fallback home
if (-not $Env:KOMOREBI_CONFIG_HOME) {
if (-not $Env:USERPROFILE) { throw "USERPROFILE missing; cannot start komorebi-bar" }
$Env:KOMOREBI_CONFIG_HOME = "$Env:USERPROFILE\.config\komorebi"
}
& komorebi-bar Prevention
- Export KOMOREBI_CONFIG_HOME in every environment that can start the bar (profile, service definition, task scheduler action).
- Run the bar from a normal login shell so USERPROFILE is populated.
- Add a startup env check to any wrapper script around komorebi-bar.
- In containers/CI, explicitly set HOME before invoking the binary.
When it happens
Trigger: Executing the komorebi-bar binary where `KOMOREBI_CONFIG_HOME` is unset and `dirs::home_dir()` returns None — i.e. `USERPROFILE`/`HOME` absent from the process environment at process start.
Common situations: Starting the bar from a stripped-environment context (Windows service, scheduled task, SSH session without a profile), CI/container runs with no USERPROFILE, or a corrupted user profile so the home dir lookup fails.
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
- there is no home directory
- $Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is
- there is no home directory
- $Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is
- no home directory found
AI-assisted analysis of LGUG2Z/komorebi@e0709f02bf (2026-09-06).
Data as JSON: /api/errors/d7cc04273a10f8c3.
Report an issue: GitHub.