{"record":{"id":"87c3702d796189bd","repo":"LGUG2Z/komorebi","slug":"there-is-no-local-data-directory","errorCode":null,"errorMessage":"there is no local data directory","messagePattern":"there is no local data directory","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"komorebi/src/lib.rs","lineNumber":213,"sourceCode":"        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 = {\n        matches!(\n            os_info::get().version(),\n            Version::Semantic(_, _, x) if x >= &22000\n        )\n    };\n\n    // Use app-specific titlebar removal options where possible","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebi/src/lib.rs#L195-L231","documentation":"DATA_DIR is a lazily-initialized static computed once from dirs::data_local_dir(). If the OS provides no local data directory (e.g. HOME/profile environment broken), the expect panics with this message at first access of DATA_DIR. This happens on Windows when the %LOCALAPPDATA% env var is unset, or on Unix when XDG_DATA_HOME and HOME are both missing.","triggerScenarios":"First access of DATA_DIR (komorebi/src/lib.rs:213) while dirs::data_local_dir() returns None, typically because KOMOREBI runs in an environment where the per-user local app-data path cannot be resolved.","commonSituations":"Running komorebi from a service/scheduler context with a stripped environment; broken %LOCALAPPDATA% on Windows after user profile issues; Unix-like CI shells with no HOME or XDG_DATA_HOME.","solutions":["Ensure %LOCALAPPDATA% (Windows) or $HOME / $XDG_DATA_HOME (Unix) is set for the process launching komorebi","Re-create the user profile environment variables if they were lost","Run komorebi as an interactive user, not under a system account with no profile","If vendoring, replace the expect with a fallback path and log a clear error instead of panicking"],"exampleFix":"// before\npub static ref DATA_DIR: PathBuf = dirs::data_local_dir().expect(\"there is no local data directory\").join(\"komorebi\");\n// after\npub static ref DATA_DIR: PathBuf = dirs::data_local_dir().unwrap_or_else(|| {\n    std::env::var_os(\"LOCALAPPDATA\").map(PathBuf::from)\n        .unwrap_or_else(|| PathBuf::from(\".\")).join(\"komorebi\")\n});","handlingStrategy":"validation","validationCode":"if std::env::var_os(\"LOCALAPPDATA\").is_none() && std::env::var_os(\"HOME\").is_none() {\n    panic!(\"no local data directory: set LOCALAPPDATA or HOME before starting\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always launch komorebi from an interactive user session with a normal environment","Verify %LOCALAPPDATA% exists before automating komorebi launches","Avoid running komorebi under system/service accounts without user profiles"],"tags":["panic","environment","filesystem","windows"],"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-14T00:17:10.932Z"}