{"record":{"id":"1d501fbc929de66a","repo":"LGUG2Z/komorebi","slug":"could-not-find-localdata-dir","errorCode":null,"errorMessage":"could not find localdata dir","messagePattern":"could not find localdata dir","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"komorebic/src/main.rs","lineNumber":1745,"sourceCode":"                    );\n                    io::stdout().flush()?;\n                    let mut input = String::new();\n                    io::stdin().read_line(&mut input)?;\n                    let trimmed = input.trim().to_lowercase();\n                    if trimmed == \"y\" || trimmed == \"yes\" {\n                        std::fs::write(path, content)?;\n                        created_files.push(path.display().to_string());\n                    } else {\n                        println!(\"Skipping {}\", path.display());\n                    }\n                } else {\n                    std::fs::write(path, content)?;\n                    created_files.push(path.display().to_string());\n                }\n                Ok(())\n            }\n\n            let local_appdata_dir = dirs::data_local_dir().expect(\"could not find localdata dir\");\n            let data_dir = local_appdata_dir.join(\"komorebi\");\n            std::fs::create_dir_all(&*WHKD_CONFIG_DIR)?;\n            std::fs::create_dir_all(&*HOME_DIR)?;\n            std::fs::create_dir_all(data_dir)?;\n\n            let mut komorebi_json = include_str!(\"../../docs/komorebi.example.json\").to_string();\n            let komorebi_bar_json =\n                include_str!(\"../../docs/komorebi.bar.example.json\").to_string();\n\n            if std::env::var(\"KOMOREBI_CONFIG_HOME\").is_ok() {\n                komorebi_json =\n                    komorebi_json.replace(\"Env:USERPROFILE\", \"Env:KOMOREBI_CONFIG_HOME\");\n            }\n\n            let komorebi_path = HOME_DIR.join(\"komorebi.json\");\n            let bar_path = HOME_DIR.join(\"komorebi.bar.json\");\n            let applications_path = HOME_DIR.join(\"applications.json\");\n            let whkdrc_path = WHKD_CONFIG_DIR.join(\"whkdrc\");","sourceCodeStart":1727,"sourceCodeEnd":1763,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebic/src/main.rs#L1727-L1763","documentation":"During first-run setup, komorebic fetches dirs::data_local_dir() to locate %LOCALAPPDATA%\\komorebi where example configs and state live. If the local data directory cannot be determined, it panics with 'could not find localdata dir'. This runs inside the config-generation/quickstart flow.","triggerScenarios":"Running commands like 'komorebic quickstart' or config generation while %LOCALAPPDATA% is unset or unresolvable, causing dirs::data_local_dir() to return None.","commonSituations":"First-time setup executed from a service, remote shell, or scheduled task lacking LOCALAPPDATA; fresh Windows accounts with shell-folder registration issues; launching from a stripped environment.","solutions":["Set LOCALAPPDATA to C:\\Users\\<user>\\AppData\\Local before running the command","Run the setup from a normal interactive shell","Create the komorebi config directories manually (e.g. ~/.config/komorebi) if you only need the JSON config","Copy docs/komorebi.example.json manually into your config home instead of relying on quickstart"],"exampleFix":"// before: quickstart cannot find localdata\nkomorebic quickstart\n// after (cmd)\nset LOCALAPPDATA=C:\\Users\\me\\AppData\\Local\nkomorebic quickstart","handlingStrategy":"validation","validationCode":"# bash: guard before quickstart-style setup\n[ -n \"$LOCALAPPDATA\" ] || { echo 'LOCALAPPDATA must be set'; exit 1; }\n[ -d \"$LOCALAPPDATA\" ] || { echo 'LOCALAPPDATA is not a directory'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run first-time setup (quickstart) from a normal interactive shell","Set LOCALAPPDATA in scheduled tasks or remote shells that run komorebic","Copy example configs manually if %LOCALAPPDATA% is unavailable","Check shell-folder registration on fresh Windows accounts"],"tags":["rust","windows","environment","setup"],"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"}