{"record":{"id":"67e975be8cf5dd1b","repo":"LGUG2Z/komorebi","slug":"env-whkd-config-home-is-set-to-home-path-whi","errorCode":null,"errorMessage":"$Env:WHKD_CONFIG_HOME is set to '{home_path}', which is not a valid directory","messagePattern":"\\$Env:WHKD_CONFIG_HOME is set to '(.+?)', which is not a valid directory","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"komorebi-shortcuts/src/main.rs","lineNumber":29,"sourceCode":"impl Quicklook {\n    fn new(_cc: &eframe::CreationContext<'_>) -> Self {\n        // Customize egui here with cc.egui_ctx.set_fonts and cc.egui_ctx.set_visuals.\n        // Restore app state using cc.storage (requires the \"persistence\" feature).\n        // Use the cc.gl (a glow::Context) to create graphics shaders and buffers that you can use\n        // for e.g. egui::PaintCallback.\n        let mut home = std::env::var(\"WHKD_CONFIG_HOME\").map_or_else(\n            |_| {\n                dirs::home_dir()\n                    .expect(\"no home directory found\")\n                    .join(\".config\")\n            },\n            |home_path| {\n                let home = PathBuf::from(&home_path);\n\n                if home.as_path().is_dir() {\n                    home\n                } else {\n                    panic!(\n                        \"$Env:WHKD_CONFIG_HOME is set to '{home_path}', which is not a valid directory\",\n                    );\n                }\n            },\n        );\n        home.push(\"whkdrc\");\n\n        Self {\n            whkdrc: whkd_parser::load(&home).ok(),\n            filter: String::new(),\n        }\n    }\n}\n\nimpl eframe::App for Quicklook {\n    fn update(&mut self, ctx: &eframe::egui::Context, _frame: &mut eframe::Frame) {\n        eframe::egui::CentralPanel::default().show(ctx, |ui| {\n            ui.set_max_width(ui.available_width());","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebi-shortcuts/src/main.rs#L11-L47","documentation":"whkd resolves its config directory from the WHKD_CONFIG_HOME environment variable. If that variable is set but points to a path that is not an existing directory, new() panics with this message instead of silently using a bad path.","triggerScenarios":"Setting $Env:WHKD_CONFIG_HOME to a path that does not exist, was deleted, is a file rather than a directory, or contains a typo before launching whkd.","commonSituations":"Environment variable left over after moving/deleting the config folder; mistyped path; WHKD_CONFIG_HOME pointing to a file (e.g. the whkdrc itself instead of its folder); USB/network drive not mounted.","solutions":["Verify the path exists and is a directory: Test-Path $Env:WHKD_CONFIG_HOME -PathType Container.","Fix or remove the variable: set $Env:WHKD_CONFIG_HOME to the folder containing whkdrc, or unset it to fall back to the default location.","Create the directory if it is missing: New-Item -ItemType Directory -Force $Env:WHKD_CONFIG_HOME."],"exampleFix":"// before\n$Env:WHKD_CONFIG_HOME = \"C:\\Users\\me\\.config\\whkd\"\n// (folder was deleted)\n// after\nNew-Item -ItemType Directory -Force \"$HOME\\.config\\whkd\"\nCopy-Item whkdrc \"$HOME\\.config\\whkd\\\"","handlingStrategy":"validation","validationCode":"if ($env:WHKD_CONFIG_HOME -and -not (Test-Path $env:WHKD_CONFIG_HOME -PathType Container)) { throw \"WHKD_CONFIG_HOME is not a valid directory\" }","typeGuard":"fn valid_config_home(home_path: &str) -> bool {\n    std::path::Path::new(home_path).is_dir()\n}","tryCatchPattern":"std::panic::catch_unwind(whkd::config::Config::new).map_err(|_| anyhow!(\"check $Env:WHKD_CONFIG_HOME points to an existing directory\"))","preventionTips":["Set WHKD_CONFIG_HOME in your shell profile only after the directory exists","Point it at the folder containing whkdrc, not the file itself","Test-Path -PathType Container before launching whkd"],"tags":["environment-variable","config-home","path"],"backgroundTag":"path-is-not-a-directory","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"}