{"record":{"id":"92df8f50c9cfbf1f","repo":"LGUG2Z/komorebi","slug":"there-is-no-home-directory-92df8f","errorCode":null,"errorMessage":"there is no home directory","messagePattern":"there is no home directory","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"komorebic/src/main.rs","lineNumber":70,"sourceCode":"use komorebi_client::DefaultLayout;\nuse komorebi_client::FocusFollowsMouseImplementation;\nuse komorebi_client::HidingBehaviour;\nuse komorebi_client::MoveBehaviour;\nuse komorebi_client::OperationBehaviour;\nuse komorebi_client::OperationDirection;\nuse komorebi_client::Rect;\nuse komorebi_client::Sizing;\nuse komorebi_client::SocketMessage;\nuse komorebi_client::StateQuery;\nuse komorebi_client::StaticConfig;\nuse komorebi_client::WindowKind;\nuse komorebi_client::splash::ValidationFeedback;\n\nlazy_static! {\n    static ref HAS_CUSTOM_CONFIG_HOME: AtomicBool = AtomicBool::new(false);\n    static ref HOME_DIR: PathBuf = {\n        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                if home.as_path().is_dir() {\n                    HAS_CUSTOM_CONFIG_HOME.store(true, Ordering::SeqCst);\n                    home\n                } else {\n                    panic!(\n                        \"$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory\",\n                    );\n                }\n            },\n        )\n    };\n    static ref DATA_DIR: PathBuf = dirs::data_local_dir()\n        .expect(\"there is no local data directory\")\n        .join(\"komorebi\");\n    static ref WHKD_CONFIG_DIR: PathBuf = {\n        std::env::var(\"WHKD_CONFIG_HOME\").map_or_else(","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebic/src/main.rs#L52-L88","documentation":"komorebic resolves its configuration directory via the HOME_DIR lazy static: it honors KOMOREBI_CONFIG_HOME if set and valid, otherwise falls back to dirs::home_dir(). The 'there is no home directory' panic fires when KOMOREBI_CONFIG_HOME is unset (or points to a non-directory) AND the OS cannot supply a home directory.","triggerScenarios":"Running komorebic with KOMOREBI_CONFIG_HOME unset or pointing at a path that is not an existing directory, while dirs::home_dir() returns None (no HOME/USERPROFILE resolvable).","commonSituations":"Running komorebic from a service account or scheduled task with no USERPROFILE set; launching from a stripped environment (empty env); CI containers without a home dir; a typo in KOMOREBI_CONFIG_HOME making the fallback path run.","solutions":["Set KOMOREBI_CONFIG_HOME to an existing directory containing your komorebi.json","Ensure USERPROFILE (Windows) or HOME is set in the environment running komorebic","Create the home directory if it was removed (e.g. mkdir /home/user or restore the Windows profile)","Run komorebic from a normal user shell rather than a system/service account"],"exampleFix":"// before: komorebic run (fails with no USERPROFILE)\nkomorebic run\n// after\nexport KOMOREBI_CONFIG_HOME=\"$HOME/.config/komorebi\"\nkomorebic run","handlingStrategy":"validation","validationCode":"if !isset($_ENV['HOME']) && !isset($_ENV['USERPROFILE']) && getenv('KOMOREBI_CONFIG_HOME') === false) {\n  throw new RuntimeException('Set KOMOREBI_CONFIG_HOME or a home dir before running komorebic');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set KOMOREBI_CONFIG_HOME to an existing directory in service/CI environments","Verify USERPROFILE (Windows) or HOME exists before launching komorebic","Never run komorebic under accounts without a home directory","Check the KOMOREBI_CONFIG_HOME path is a real directory (typo check)"],"tags":["rust","environment","config","panic"],"backgroundTag":"missing-env-var","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"}