LGUG2Z/komorebi · error
could not find localdata dir
Error message
could not find localdata dir
What it means
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.
Source
Thrown at komorebic/src/main.rs:1745
);
io::stdout().flush()?;
let mut input = String::new();
io::stdin().read_line(&mut input)?;
let trimmed = input.trim().to_lowercase();
if trimmed == "y" || trimmed == "yes" {
std::fs::write(path, content)?;
created_files.push(path.display().to_string());
} else {
println!("Skipping {}", path.display());
}
} else {
std::fs::write(path, content)?;
created_files.push(path.display().to_string());
}
Ok(())
}
let local_appdata_dir = dirs::data_local_dir().expect("could not find localdata dir");
let data_dir = local_appdata_dir.join("komorebi");
std::fs::create_dir_all(&*WHKD_CONFIG_DIR)?;
std::fs::create_dir_all(&*HOME_DIR)?;
std::fs::create_dir_all(data_dir)?;
let mut komorebi_json = include_str!("../../docs/komorebi.example.json").to_string();
let komorebi_bar_json =
include_str!("../../docs/komorebi.bar.example.json").to_string();
if std::env::var("KOMOREBI_CONFIG_HOME").is_ok() {
komorebi_json =
komorebi_json.replace("Env:USERPROFILE", "Env:KOMOREBI_CONFIG_HOME");
}
let komorebi_path = HOME_DIR.join("komorebi.json");
let bar_path = HOME_DIR.join("komorebi.bar.json");
let applications_path = HOME_DIR.join("applications.json");
let whkdrc_path = WHKD_CONFIG_DIR.join("whkdrc");View on GitHub (pinned to e0709f02bf)
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
Example fix
// before: quickstart cannot find localdata komorebic quickstart // after (cmd) set LOCALAPPDATA=C:\Users\me\AppData\Local komorebic quickstart
Defensive patterns
Strategy: validation
Validate before calling
# bash: guard before quickstart-style setup
[ -n "$LOCALAPPDATA" ] || { echo 'LOCALAPPDATA must be set'; exit 1; }
[ -d "$LOCALAPPDATA" ] || { echo 'LOCALAPPDATA is not a directory'; exit 1; } Prevention
- 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
When it happens
Trigger: Running commands like 'komorebic quickstart' or config generation while %LOCALAPPDATA% is unset or unresolvable, causing dirs::data_local_dir() to return None.
Common situations: 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.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- no home directory found
- there is no home directory
- there is no local data directory
- unable to obtain user's home folder
- there is no home directory
AI-assisted analysis of LGUG2Z/komorebi@e0709f02bf (2026-09-06).
Data as JSON: /api/errors/1d501fbc929de66a.
Report an issue: GitHub.