LGUG2Z/komorebi · error
{}
Error message
{} What it means
print_query is a komorebic helper that sends a query socket message to the komorebi process and prints the response. If send_query fails (connection failure, timeout, malformed response), the helper panics by formatting the underlying error into the panic message via panic!("{}", error).
Source
Thrown at komorebic/src/main.rs:1589
NotificationSchema,
/// Generate a JSON Schema of socket messages
SocketSchema,
/// Generate a JSON Schema of the static configuration file
StaticConfigSchema,
/// Generates a static configuration JSON file based on the current window manager state
GenerateStaticConfig,
/// Generates the komorebi.lnk shortcut in shell:startup to autostart komorebi
EnableAutostart(EnableAutostart),
/// Deletes the komorebi.lnk shortcut in shell:startup to disable autostart
DisableAutostart,
}
// print_query is a helper that queries komorebi and prints the response.
// panics on error.
fn print_query(message: &SocketMessage) {
match send_query(message) {
Ok(response) => println!("{response}"),
Err(error) => panic!("{}", error),
}
}
fn startup_dir() -> eyre::Result<PathBuf> {
let startup = dirs::home_dir()
.expect("unable to obtain user's home folder")
.join("AppData")
.join("Roaming")
.join("Microsoft")
.join("Windows")
.join("Start Menu")
.join("Programs")
.join("Startup");
if !startup.is_dir() {
std::fs::create_dir_all(&startup)?;
}
View on GitHub (pinned to e0709f02bf)
Solutions
- Start komorebi first (komorebic start) and confirm it is running before querying.
- Check komorebic and komorebi are the same version (komorebic --version vs the running process).
- Run the command inside the same user session / with correct privileges so the socket is reachable.
- Catch the underlying error text in the panic message to identify connection vs decode failure.
Example fix
// before komorebic query --state # komorebi not running -> panic // after komorebic start komorebic query --state
Defensive patterns
Strategy: try-catch
Validate before calling
komorebic state 2>$null; if ($LASTEXITCODE -ne 0) { throw 'komorebi is not running; start it before querying' } Try / catch
match std::panic::catch_unwind(|| print_query(&msg)) {
Ok(_) => {},
Err(e) => eprintln!("query failed — is komorebi running? {:?}", e),
} Prevention
- Always start komorebi before running komorebic query commands
- Keep komorebic and komorebi versions in sync
- Run queries from the same user session as komorebi
When it happens
Trigger: Calling any komorebic query subcommand (e.g. `komorebic query`, state/monitor queries) when komorebi is not running, the named pipe/socket is unavailable, the request timed out, or the response could not be decoded.
Common situations: Running a query command before starting komorebi; komorebi crashed or was restarted; wrong KOMOREBI_SOCKET name; permission issues on the socket; version mismatch between komorebic and komorebi.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- could not subscribe to komorebi notifications
- could not connect to komorebi.sock
- could not write to komorebi.sock
AI-assisted analysis of LGUG2Z/komorebi@e0709f02bf (2026-09-06).
Data as JSON: /api/errors/04a60026bdde4761.
Report an issue: GitHub.