LGUG2Z/komorebi · error

$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is

Error message

$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory

What it means

komorebic resolves its config directory from the KOMOREBI_CONFIG_HOME environment variable. If the variable is set but the path is not an existing directory, startup panics with this message. On success it also records that a custom config home is in use.

Source

Thrown at komorebic/src/main.rs:77

use komorebi_client::Sizing;
use komorebi_client::SocketMessage;
use komorebi_client::StateQuery;
use komorebi_client::StaticConfig;
use komorebi_client::WindowKind;
use komorebi_client::splash::ValidationFeedback;

lazy_static! {
    static ref HAS_CUSTOM_CONFIG_HOME: AtomicBool = AtomicBool::new(false);
    static ref 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();
                if home.as_path().is_dir() {
                    HAS_CUSTOM_CONFIG_HOME.store(true, Ordering::SeqCst);
                    home
                } else {
                    panic!(
                        "$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory",
                    );
                }
            },
        )
    };
    static ref DATA_DIR: PathBuf = dirs::data_local_dir()
        .expect("there is no local data directory")
        .join("komorebi");
    static ref WHKD_CONFIG_DIR: PathBuf = {
        std::env::var("WHKD_CONFIG_HOME").map_or_else(
            |_| {
                dirs::home_dir()
                    .expect("there is no home directory")
                    .join(".config")
            },
            |home_path| {
                let whkd_config_home = home_path.replace_env();

View on GitHub (pinned to e0709f02bf)

Solutions

  1. Check the value: Test-Path $Env:KOMOREBI_CONFIG_HOME -PathType Container.
  2. Correct the variable to the directory containing komorebi.json/bar.json, or remove it: Remove-Item Env:KOMOREBI_CONFIG_HOME.
  3. Recreate the directory if it was deleted.

Example fix

// before
$Env:KOMOREBI_CONFIG_HOME = "C:\Users\me\.config\komorebi"
// path missing
// after
$Env:KOMOREBI_CONFIG_HOME = "$HOME\.config\komorebi"
New-Item -ItemType Directory -Force $Env:KOMOREBI_CONFIG_HOME
Defensive patterns

Strategy: validation

Validate before calling

if ($env:KOMOREBI_CONFIG_HOME -and -not (Test-Path $env:KOMOREBI_CONFIG_HOME -PathType Container)) { throw "KOMOREBI_CONFIG_HOME is not a valid directory" }

Type guard

fn valid_config_home(home_path: &str) -> bool {
    std::path::Path::new(home_path).is_dir()
}

Try / catch

std::panic::catch_unwind(|| komorebic::startup()).map_err(|_| anyhow!("verify KOMOREBI_CONFIG_HOME points to an existing directory"))

Prevention

When it happens

Trigger: Launching komorebic with KOMOREBI_CONFIG_HOME set to a non-existent path, a path pointing at a file, a typo'd path, or a drive that is not mounted.

Common situations: Stale env var after reorganizing the dotfiles; copying setup instructions with a different username in the path; pointing at the config file instead of its parent directory.

Related errors


AI-assisted analysis of LGUG2Z/komorebi@e0709f02bf (2026-09-06). Data as JSON: /api/errors/c139a85c1f64376c. Report an issue: GitHub.