LGUG2Z/komorebi · critical

there is no local data directory

Error message

there is no local data directory

What it means

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'.

Source

Thrown at komorebic/src/main.rs:85

    static ref HAS_CUSTOM_CONFIG_HOME: AtomicBool = AtomicBool::new(false);
    static ref HOME_DIR: PathBuf = {
        std::env::var("KOMOREBI_CONFIG_HOME").map_or_else(
            |_| dirs::home_dir().expect("there is no home directory"),
            |home_path| {
                let home = home_path.replace_env();
                if home.as_path().is_dir() {
                    HAS_CUSTOM_CONFIG_HOME.store(true, Ordering::SeqCst);
                    home
                } else {
                    panic!(
                        "$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory",
                    );
                }
            },
        )
    };
    static ref DATA_DIR: PathBuf = dirs::data_local_dir()
        .expect("there is no local data directory")
        .join("komorebi");
    static ref WHKD_CONFIG_DIR: PathBuf = {
        std::env::var("WHKD_CONFIG_HOME").map_or_else(
            |_| {
                dirs::home_dir()
                    .expect("there is no home directory")
                    .join(".config")
            },
            |home_path| {
                let whkd_config_home = home_path.replace_env();

                assert!(
                    whkd_config_home.is_dir(),
                    "$Env:WHKD_CONFIG_HOME is set to '{home_path}', which is not a valid directory"
                );

                whkd_config_home
            },

View on GitHub (pinned to e0709f02bf)

Solutions

  1. Ensure the LOCALAPPDATA environment variable is set (typically C:\Users\<user>\AppData\Local)
  2. Run komorebic as an interactive user, not a SYSTEM/service account
  3. Repair the Windows user profile if AppData folders are missing
  4. Upgrade komorebi in case a newer version handles missing data dirs differently

Example fix

// before: fails when LOCALAPPDATA is unset
komorebic state
// after (cmd)
set LOCALAPPDATA=C:\Users\me\AppData\Local
komorebic state
Defensive patterns

Strategy: validation

Validate before calling

# PowerShell: ensure LOCALAPPDATA resolves before running komorebic
if (-not $env:LOCALAPPDATA -or -not (Test-Path $env:LOCALAPPDATA)) {
  throw "LOCALAPPDATA is not set/valid; komorebic will panic"
}

Prevention

When it happens

Trigger: dirs::data_local_dir() returns None, which on Windows happens when %LOCALAPPDATA% / the user profile is not resolvable in the environment running komorebic.

Common situations: 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.

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


AI-assisted analysis of LGUG2Z/komorebi@e0709f02bf (2026-09-06). Data as JSON: /api/errors/cf947b0ab0a14fb3. Report an issue: GitHub.