{"record":{"id":"0a9e7b5e6b627001","repo":"LGUG2Z/komorebi","slug":"env-komorebi-config-home-is-set-to-home-path-0a9e7b","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-bar/src/bar.rs","lineNumber":640,"sourceCode":"            Some(theme) => {\n                apply_theme(\n                    ctx,\n                    theme.clone(),\n                    self.bg_color.clone(),\n                    self.bg_color_with_alpha.clone(),\n                    self.config.transparency_alpha,\n                    self.config.grouping,\n                    self.render_config.clone(),\n                );\n            }\n            None => {\n                let home_dir: PathBuf = std::env::var(\"KOMOREBI_CONFIG_HOME\").map_or_else(\n                    |_| dirs::home_dir().expect(\"there is no home directory\"),\n                    |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                        home\n\n                    },\n                );\n\n                let bar_transparency_alpha = self.config.transparency_alpha;\n                let bar_grouping = self.config.grouping;\n                let config = home_dir.join(\"komorebi.json\");\n                match komorebi_client::StaticConfig::read(&config) {\n                    Ok(config) => {\n                        if let Some(theme) = config.theme {\n                            apply_theme(\n                                ctx,\n                                KomobarTheme::from(theme),\n                                self.bg_color.clone(),","sourceCodeStart":622,"sourceCodeEnd":658,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebi-bar/src/bar.rs#L622-L658","documentation":"In `try_apply_theme`, when `KOMOREBI_CONFIG_HOME` is set, komorebi-bar expands env vars with `replace_env()` and then asserts that the resulting path `is_dir()`. The assertion `\"$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory\"` panics when the variable points to a nonexistent path or a file instead of a directory.","triggerScenarios":"Starting the bar with `KOMOREBI_CONFIG_HOME` set to a path that does not exist, was typo'd, points to a file, or contains env-var references that fail to expand into an existing directory — reached via `apply_config` or `update` calls to `try_apply_theme`.","commonSituations":"Typo in the directory name when setting the env var, pointing it at a config *file* instead of its containing directory, deleting or renaming the folder after setting the var, or setting it in a different shell/session than the one launching the bar with stale quoting.","solutions":["Verify the path exists and is a directory: run `Test-Path $Env:KOMOREBI_CONFIG_HOME -PathType Container` and fix or create the directory.","Correct the value: `$Env:KOMOREBI_CONFIG_HOME = 'C:\\Users\\you\\.config\\komorebi'` (directory, not the komorebi.json file).","Persist the corrected value in your profile or system environment variables so the bar always sees a valid path.","If env-var expansion inside the value is intended, make sure the referenced variables are set in the same session that launches the bar."],"exampleFix":"// before (shell setup that triggers the panic)\n$Env:KOMOREBI_CONFIG_HOME = \"$Env:USERPROFILE\\.config\\komorebi\\komorebi.json\"\n// after\n$Env:KOMOREBI_CONFIG_HOME = \"$Env:USERPROFILE\\.config\\komorebi\"","handlingStrategy":"validation","validationCode":"# validate before launching the bar (PowerShell)\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}","typeGuard":"fn is_valid_config_home(home: &Path) -> bool {\n    home.is_dir()\n}","tryCatchPattern":"// caller-side guard mirroring the library assert\nif !home.is_dir() {\n    eprintln!(\"KOMOREBI_CONFIG_HOME='{}' is not a valid directory\", home_path);\n    std::process::exit(1);\n}","preventionTips":["Point KOMOREBI_CONFIG_HOME at the directory containing komorebi.json, not the file itself.","Run `Test-Path $Env:KOMOREBI_CONFIG_HOME -PathType Container` after changing the variable.","Create the directory before setting the variable if it does not exist yet.","Avoid nested env-var expansion in the value unless the referenced vars are always set."],"tags":["rust","panic","environment","config","path-validation"],"backgroundTag":"invalid-env-var-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"}