{"record":{"id":"b77c8c4ecd662297","repo":"LGUG2Z/komorebi","slug":"env-komorebi-config-home-is-set-to-home-path-b77c8c","errorCode":null,"errorMessage":"$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory","messagePattern":"\\$Env:KOMOREBI_CONFIG_HOME is set to '(.+?)', which is not a valid directory","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"komorebi/src/lib.rs","lineNumber":206,"sourceCode":"    static ref DUPLICATE_MONITOR_SERIAL_IDS: Arc<RwLock<Vec<String>>> =\n        Arc::new(RwLock::new(Vec::new()));\n    static ref SUBSCRIPTION_PIPES: Arc<Mutex<HashMap<String, File>>> =\n        Arc::new(Mutex::new(HashMap::new()));\n    pub static ref SUBSCRIPTION_SOCKETS: Arc<Mutex<HashMap<String, PathBuf>>> =\n        Arc::new(Mutex::new(HashMap::new()));\n    pub static ref SUBSCRIPTION_SOCKET_OPTIONS: Arc<Mutex<HashMap<String, SubscribeOptions>>> =\n        Arc::new(Mutex::new(HashMap::new()));\n    static ref TCP_CONNECTIONS: Arc<Mutex<HashMap<String, TcpStream>>> =\n        Arc::new(Mutex::new(HashMap::new()));\n    static ref HIDING_BEHAVIOUR: Arc<Mutex<HidingBehaviour>> =\n        Arc::new(Mutex::new(HidingBehaviour::Cloak));\n    pub static ref HOME_DIR: PathBuf = {\n        std::env::var(\"KOMOREBI_CONFIG_HOME\").map_or_else(|_| dirs::home_dir().expect(\"there is no home directory\"), |home_path| {\n            let home = home_path.replace_env();\n\n            assert!(\n                home.is_dir(),\n                \"$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory\"\n            );\n\n\n            home\n        })\n    };\n    pub static ref DATA_DIR: PathBuf = dirs::data_local_dir().expect(\"there is no local data directory\").join(\"komorebi\");\n    pub static ref AHK_EXE: String = {\n        let mut ahk: String = String::from(\"autohotkey.exe\");\n\n        if let Ok(komorebi_ahk_exe) = std::env::var(\"KOMOREBI_AHK_EXE\")\n            && which(&komorebi_ahk_exe).is_ok() {\n                ahk = komorebi_ahk_exe;\n            }\n\n        ahk\n    };\n    static ref WINDOWS_11: bool = {","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebi/src/lib.rs#L188-L224","documentation":"When KOMOREBI_CONFIG_HOME is set, komorebi validates that the resolved path is an existing directory via assert!(home.is_dir()) inside the HOME_DIR initializer. If the variable points at a nonexistent path or a file, the assertion panics with this interpolated message. This is fail-fast validation of a user-provided configuration directory.","triggerScenarios":"KOMOREBI_CONFIG_HOME is set to a path that does not exist, was deleted, contains a typo, includes unexpanded environment variables that resolve to nothing, or points to a regular file instead of a directory.","commonSituations":"Typo'd path in PowerShell $PROFILE (e.g. missing backslash); moving/renaming the config folder after setting the variable; using a forward-slash or quoted path that resolves incorrectly; setting the variable system-wide but never creating the directory; variable set on a machine where the config was never bootstrapped (komorebic quickstart).","solutions":["Create the directory the variable points to (mkdir $Env:KOMOREBI_CONFIG_HOME) or run `komorebic quickstart` to regenerate a config","Fix the KOMOREBI_CONFIG_HOME value to point at the real config directory containing config.json","Temporarily unset KOMOREBI_CONFIG_HOME so komorebi falls back to ~/.config/komorebi","Verify the path is a directory, not a file, and that any embedded env vars in the value expand correctly (komorebi applies replace_env to it)"],"exampleFix":"// before (PowerShell)\n$env:KOMOREBI_CONFIG_HOME = \"C:\\Users\\me\\.config\\komorebi-old\"\n// after (PowerShell)\n$env:KOMOREBI_CONFIG_HOME = \"C:\\Users\\me\\.config\\komorebi\"\nif (-not (Test-Path $env:KOMOREBI_CONFIG_HOME -PathType Container)) {\n  komorebic quickstart\n}","handlingStrategy":"validation","validationCode":"// PowerShell: validate KOMOREBI_CONFIG_HOME before starting komorebi\nif ($env:KOMOREBI_CONFIG_HOME -and -not (Test-Path $env:KOMOREBI_CONFIG_HOME -PathType Container)) {\n  throw \"KOMOREBI_CONFIG_HOME='$($env:KOMOREBI_CONFIG_HOME)' is not a valid directory\"\n}\nkomorebic start -a whkd","typeGuard":"// Rust\nfn valid_config_home(home_path: &str) -> bool {\n    PathBuf::from(home_path.replace_env()).is_dir()\n}","tryCatchPattern":"// Downstream: resolve without triggering the panic\nmatch std::env::var(\"KOMOREBI_CONFIG_HOME\") {\n    Ok(p) if PathBuf::from(&p).is_dir() => Some(PathBuf::from(p)),\n    Ok(p) => { log::error!(\"KOMOREBI_CONFIG_HOME='{p}' is not a valid directory\"); None }\n    Err(_) => dirs::home_dir().map(|h| h.join(\".config\")),\n}","preventionTips":["Run komorebic quickstart to bootstrap a valid config directory","Test-Path any custom KOMOREBI_CONFIG_HOME in launch scripts before use","Point the variable at a directory, never a file","Expand all env vars inside the value yourself and confirm they resolve","Unset the variable if you want the default ~/.config/komorebi location"],"tags":["windows","rust","panic","config-path","invalid-path"],"backgroundTag":"invalid-config-value","analyzedSha":"e0709f02bfae4e503bf4640f58ee75ecbbfdbb97","analyzedAt":"2026-09-06T07:08:05.107Z","contentChangedAt":"2026-09-06T07:08:05.107Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}