{"record":{"id":"cf947b0ab0a14fb3","repo":"LGUG2Z/komorebi","slug":"there-is-no-local-data-directory-cf947b","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":"komorebic/src/main.rs","lineNumber":85,"sourceCode":"    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(\n            |_| {\n                dirs::home_dir()\n                    .expect(\"there is no home directory\")\n                    .join(\".config\")\n            },\n            |home_path| {\n                let whkd_config_home = home_path.replace_env();\n\n                assert!(\n                    whkd_config_home.is_dir(),\n                    \"$Env:WHKD_CONFIG_HOME is set to '{home_path}', which is not a valid directory\"\n                );\n\n                whkd_config_home\n            },","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebic/src/main.rs#L67-L103","documentation":"The DATA_DIR lazy static in komorebic resolves the per-user local data directory via dirs::data_local_dir() and appends 'komorebi'. If the OS cannot determine the local data dir (on Windows: %LOCALAPPDATA%), komorebic panics with 'there is no local data directory'.","triggerScenarios":"dirs::data_local_dir() returns None, which on Windows happens when %LOCALAPPDATA% / the user profile is not resolvable in the environment running komorebic.","commonSituations":"Running komorebic from a service or scheduler with LOCALAPPDATA unset; corrupted user profile; launching from a sandboxed/minimal environment where the standard Windows shell folders are unavailable.","solutions":["Ensure the LOCALAPPDATA environment variable is set (typically C:\\Users\\<user>\\AppData\\Local)","Run komorebic as an interactive user, not a SYSTEM/service account","Repair the Windows user profile if AppData folders are missing","Upgrade komorebi in case a newer version handles missing data dirs differently"],"exampleFix":"// before: fails when LOCALAPPDATA is unset\nkomorebic state\n// after (cmd)\nset LOCALAPPDATA=C:\\Users\\me\\AppData\\Local\nkomorebic state","handlingStrategy":"validation","validationCode":"# PowerShell: ensure LOCALAPPDATA resolves before running komorebic\nif (-not $env:LOCALAPPDATA -or -not (Test-Path $env:LOCALAPPDATA)) {\n  throw \"LOCALAPPDATA is not set/valid; komorebic will panic\"\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run komorebic from interactive user sessions, not SYSTEM/service contexts","Confirm %LOCALAPPDATA% exists and points to <profile>\\AppData\\Local","Repair Windows user profiles missing AppData folders","Export standard env vars when running komorebic from schedulers or CI"],"tags":["rust","windows","environment","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"}