{"record":{"id":"ba3b74e3714294e6","repo":"LGUG2Z/komorebi","slug":"env-komorebi-config-home-is-set-to-home-path-ba3b74","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/main.rs","lineNumber":174,"sourceCode":"    if std::env::var(\"RUST_LOG\").is_err() {\n        unsafe {\n            std::env::set_var(\"RUST_LOG\", \"info\");\n        }\n    }\n\n    tracing::subscriber::set_global_default(\n        tracing_subscriber::fmt::Subscriber::builder()\n            .with_env_filter(EnvFilter::from_default_env())\n            .finish(),\n    )?;\n\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    if opts.quickstart {\n        let komorebi_bar_json = include_str!(\"../../docs/komorebi.bar.example.json\").to_string();\n        std::fs::write(home_dir.join(\"komorebi.bar.json\"), komorebi_bar_json)?;\n        println!(\n            \"Example komorebi.bar.json file written to {}\",\n            home_dir.display()\n        );\n\n        std::process::exit(0);\n    }\n","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebi-bar/src/main.rs#L156-L192","documentation":"In komorebi-bar's `main`, a set `KOMOREBI_CONFIG_HOME` is env-expanded via `replace_env()` and validated with `assert!(home.is_dir(), ...)`. The panic message `\"$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory\"` aborts startup when the variable resolves to a nonexistent path or a non-directory file.","triggerScenarios":"Launching the komorebi-bar binary with `KOMOREBI_CONFIG_HOME` pointing at a missing/typo'd path, a config file instead of a directory, or a value whose embedded env-var references expand to nothing valid — the assertion in `main` fails immediately.","commonSituations":"Pointing the variable at `komorebi.json` instead of its parent folder, renaming/moving the config directory without updating the env var, setting the variable in one PowerShell profile but launching the bar from another, or quoting mistakes leaving literal `$Env:` text in the value.","solutions":["Check the resolved path: `Test-Path $Env:KOMOREBI_CONFIG_HOME -PathType Container`; if false, create the directory or fix the value.","Set the variable to the config *directory*: `$Env:KOMOREBI_CONFIG_HOME = \"$Env:USERPROFILE\\.config\\komorebi\"`.","If the value uses nested env-var expansion, confirm those variables exist in the session launching the bar.","Persist a correct value in user/system environment variables so every launch context sees a valid directory."],"exampleFix":"// before (shell setup that triggers the assert)\n$Env:KOMOREBI_CONFIG_HOME = 'C:\\Users\\you\\.config\\komorebi\\komorebi.json'\n// after\n$Env:KOMOREBI_CONFIG_HOME = 'C:\\Users\\you\\.config\\komorebi'","handlingStrategy":"validation","validationCode":"# validate before invoking the binary (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 validate_config_home(home_path: &str, home: &Path) -> Result<(), String> {\n    if home.is_dir() { Ok(()) }\n    else { Err(format!(\"$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory\")) }\n}","tryCatchPattern":"# wrapper that fails fast with a clear message instead of a panic\nif (-not (Test-Path $Env:KOMOREBI_CONFIG_HOME -PathType Container)) {\n    Write-Error \"Fix KOMOREBI_CONFIG_HOME: '$Env:KOMOREBI_CONFIG_HOME' is not a directory\"\n    exit 1\n}\n& komorebi-bar","preventionTips":["Set the variable to a directory path, never to komorebi.json itself.","Re-verify the value after moving or renaming your config folder.","Use absolute literal paths in persisted env vars to avoid expansion surprises.","Test the value with `Test-Path ... -PathType Container` in the exact shell that launches the bar."],"tags":["rust","panic","startup","environment","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-14T05:17:10.506Z"}