LGUG2Z/komorebi · error

could not load configuration

Error message

could not load configuration

What it means

reload_configuration spawns a thread running load_configuration().expect(...); any Err while parsing/loading the user's komorebi.json panics that thread with 'could not load configuration'. Because it runs in a background thread, the panic kills only that thread but the intended config reload silently never happens.

Source

Thrown at komorebi/src/window_manager.rs:340

            if let Err(error) = self.update_focused_workspace(true, true) {
                tracing::warn!(
                    "cannot update focused workspace '{focused_workspace_idx}' on monitor '{focused_monitor_idx}' from {}: {}",
                    temp_dir().join("komorebi.state.json").to_string_lossy(),
                    error,
                );
            }
        } else {
            tracing::warn!(
                "cannot apply state from {}; some windows referenced in the state file no longer exist",
                temp_dir().join("komorebi.state.json").to_string_lossy()
            );
        }
    }

    #[tracing::instrument]
    pub fn reload_configuration() {
        tracing::info!("reloading configuration");
        std::thread::spawn(|| load_configuration().expect("could not load configuration"));
    }

    #[tracing::instrument(skip(self))]
    pub fn reload_static_configuration(&mut self, pathbuf: &PathBuf) -> eyre::Result<()> {
        tracing::info!("reloading static configuration");
        StaticConfig::reload(pathbuf, self)
    }

    pub fn window_management_behaviour(
        &self,
        monitor_idx: usize,
        workspace_idx: usize,
    ) -> WindowManagementBehaviour {
        if let Some(monitor) = self.monitors().get(monitor_idx)
            && let Some(workspace) = monitor.workspaces().get(workspace_idx)
        {
            let current_behaviour = if let Some(behaviour) = workspace.window_container_behaviour {
                if workspace.containers().is_empty()

View on GitHub (pinned to e0709f02bf)

Solutions

  1. Validate komorebi.json (jq . / JSON schema) and fix syntax or schema errors
  2. Restore the config file if it was moved or deleted from KOMOREBI_CONFIG_HOME
  3. Check komorebi logs (komorebi.log) for the underlying parse error description
  4. Swap the expect for logged error handling so a bad reload doesn't abort the watcher

Example fix

// before
std::thread::spawn(|| load_configuration().expect("could not load configuration"));
// after
std::thread::spawn(|| {
    if let Err(e) = load_configuration() {
        tracing::error!("could not load configuration: {e}");
    }
});
Defensive patterns

Strategy: validation

Validate before calling

let text = std::fs::read_to_string("~/.config/komorebi/komorebi.json")?;
let _: serde_json::Value = serde_json::from_str(&text)?; // fails fast on bad JSON

Prevention

When it happens

Trigger: Calling WindowManager::reload_configuration (or triggering a manual reload) while komorebi.json is missing, unreadable, or contains schema-invalid JSON.

Common situations: Saving a hand-edited komorebi.json with a JSON syntax error or an invalid enum value; config file moved/renamed; KOMOREBI_CONFIG_HOME changed after startup.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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