LGUG2Z/komorebi · critical
could not start tcp server
Error message
could not start tcp server
What it means
listen_for_commands_tcp binds a TcpListener on 0.0.0.0:{port} (default 43663) and panics with this message if bind() fails. Common bind failures: the port is already in use by another komorebi instance or another program, or binding is blocked by permissions/policy.
Source
Thrown at komorebi/src/process_command.rs:149
}
Err(error) => {
tracing::error!("{}", error);
break;
}
}
}
})
.join();
tracing::error!("restarting failed thread");
}
});
}
#[tracing::instrument]
pub fn listen_for_commands_tcp(wm: Arc<Mutex<WindowManager>>, port: usize) {
let listener =
TcpListener::bind(format!("0.0.0.0:{port}")).expect("could not start tcp server");
std::thread::spawn(move || {
tracing::info!("listening on 0.0.0.0:43663");
for client in listener.incoming() {
match client {
Ok(mut stream) => {
net2::TcpStreamExt::set_keepalive(&stream, Some(Duration::from_secs(30)))
.expect("TCP keepalive should be set");
let addr = stream
.peer_addr()
.expect("incoming connection should have an address")
.to_string();
let mut connections = TCP_CONNECTIONS.lock();
connections.insert(
addr.clone(),View on GitHub (pinned to e0709f02bf)
Solutions
- Kill the existing komorebi.exe or other process using port 43663 (netstat -ano | findstr 43663)
- Start komorebi with a different --port via CLI option
- Remove duplicate autostart entries so only one instance launches
- Check firewall/security software that may block socket binding
Example fix
// before
let listener = TcpListener::bind(format!("0.0.0.0:{port}")).expect("could not start tcp server");
// after
let listener = match TcpListener::bind(format!("0.0.0.0:{port}")) {
Ok(l) => l,
Err(e) => { tracing::error!("could not start tcp server on {port}: {e}"); return; }
}; Defensive patterns
Strategy: validation
Validate before calling
// PowerShell: ensure port 43663 is free before starting
netstat -ano | Select-String ':43663 ' ; if ($?) { throw "port 43663 in use" } Prevention
- Ensure only one komorebi instance autostarts
- Pick a non-default port via CLI if 43663 is occupied
- Kill lingering komorebi.exe after crashes before relaunching
When it happens
Trigger: Calling main while a second komorebi instance is running, any other process listening on port 43663, or an OS-level restriction preventing the bind.
Common situations: Starting komorebi twice (e.g. duplicate autostart entries); port 43663 occupied by another app; leftover zombie komorebi.exe after a crash.
Related errors
- stream should be cloneable
- unsupported format
- Invalid command
- there is no home directory
- $Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is
AI-assisted analysis of LGUG2Z/komorebi@e0709f02bf (2026-09-06).
Data as JSON: /api/errors/9e49336864fa5557.
Report an issue: GitHub.