LGUG2Z/komorebi · error
could not find home dir
Error message
could not find home dir
What it means
When printing status/configuration diagnostics, komorebic falls back to dirs::home_dir() to display the default config location when no KOMOREBI_CONFIG_HOME is set. It panics with 'could not find home dir' when the OS home directory cannot be resolved in that fallback path.
Source
Thrown at komorebic/src/main.rs:1883
println!("in order for the autostart command to work properly");
}
SubCommand::DisableAutostart => {
let startup_dir = startup_dir()?;
let shortcut_file = startup_dir.join("komorebi.lnk");
if shortcut_file.is_file() {
std::fs::remove_file(shortcut_file)?;
}
}
SubCommand::Check(args) => {
let home_display = HOME_DIR.display();
if HAS_CUSTOM_CONFIG_HOME.load(Ordering::SeqCst) {
println!("KOMOREBI_CONFIG_HOME detected: {home_display}\n");
} else {
println!(
"No KOMOREBI_CONFIG_HOME detected, defaulting to {}\n",
dirs::home_dir()
.expect("could not find home dir")
.to_string_lossy()
);
}
println!("Looking for configuration files in {home_display}\n");
let static_config = if let Some(static_config) = args.komorebi_config {
println!(
"Using an arbitrary configuration file passed to --komorebi-config flag\n"
);
static_config
} else {
HOME_DIR.join("komorebi.json")
};
let config_pwsh = HOME_DIR.join("komorebi.ps1");
let config_ahk = HOME_DIR.join("komorebi.ahk");
let config_whkd = WHKD_CONFIG_DIR.join("whkdrc");View on GitHub (pinned to e0709f02bf)
Solutions
- Set KOMOREBI_CONFIG_HOME so the fallback to home_dir() is never taken
- Set USERPROFILE/HOME in the launching environment
- Run komorebic from a regular user shell
- Restore the missing home directory in the profile
Example fix
// before: diagnostics panic without home komorebic quickstart // after export KOMOREBI_CONFIG_HOME="$HOME/.config/komorebi" komorebic quickstart
Defensive patterns
Strategy: validation
Validate before calling
# Ensure a home or explicit config home before komorebic diagnostics if [ -z "$HOME" ] && [ -z "$USERPROFILE" ] && [ -z "$KOMOREBI_CONFIG_HOME" ]; then echo 'Set HOME or KOMOREBI_CONFIG_HOME'; exit 1 fi
Prevention
- Set KOMOREBI_CONFIG_HOME so diagnostic output never needs home_dir()
- Launch komorebic with a populated environment (HOME/USERPROFILE)
- Avoid env -i or service contexts without a user profile
- Confirm the home directory exists on disk before running komorebic commands
When it happens
Trigger: Running a komorebic command that prints config diagnostics while HAS_CUSTOM_CONFIG_HOME is false (no valid KOMOREBI_CONFIG_HOME) and dirs::home_dir() returns None.
Common situations: Running status/quickstart-like output commands from a service account or environment without USERPROFILE/HOME; containerized runs with an empty environment.
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
- Invalid command
- there is no home directory
AI-assisted analysis of LGUG2Z/komorebi@e0709f02bf (2026-09-06).
Data as JSON: /api/errors/e8bfd528a2ca9e5d.
Report an issue: GitHub.