wavetermdev/waveterm · error
window ${windowId} not found
Error message
window ${windowId} not found What it means
OpenDomainSocketListener may only run when the WslConn is in Status_Connecting. Under the connection lock it checks the status; if the connection is in any other state (connected, connecting through another path, disconnected), this error names both the connection and its current status. It guards against double-initializing the domain socket listener.
Source
Thrown at emain/emain-wsh.ts:53
new Notification({
title: notificationOptions.title,
body: notificationOptions.body,
silent: notificationOptions.silent,
}).show();
}
async handle_getupdatechannel(rh: RpcResponseHelper): Promise<string> {
return getResolvedUpdateChannel();
}
async handle_focuswindow(rh: RpcResponseHelper, windowId: string) {
console.log(`focuswindow ${windowId}`);
const fullConfig = await RpcApi.GetFullConfigCommand(ElectronWshClient);
let ww = getWaveWindowById(windowId);
if (ww == null) {
const window = await WindowService.GetWindow(windowId);
if (window == null) {
throw new Error(`window ${windowId} not found`);
}
ww = await createBrowserWindow(window, fullConfig, {
unamePlatform,
isPrimaryStartupWindow: false,
});
}
ww.focus();
}
async handle_electronencrypt(
rh: RpcResponseHelper,
data: CommandElectronEncryptData
): Promise<CommandElectronEncryptRtnData> {
if (!safeStorage.isEncryptionAvailable()) {
throw new Error("encryption is not available");
}
const encrypted = safeStorage.encryptString(data.plaintext);
const ciphertext = encrypted.toString("base64");View on GitHub (pinned to a4447c1563)
Solutions
- Check conn.GetStatus() before calling; only invoke during Status_Connecting
- Avoid calling twice — let the existing enable flow finish before re-invoking
- If the connection is already connected, the listener is likely already set up; no action needed
- Serialize enable/reconnect calls so status transitions don't race
Example fix
// before
conn.OpenDomainSocketListener(ctx) // fails if status != Connecting
// after
if conn.GetStatus() == wslconn.Status_Connecting {
err := conn.OpenDomainSocketListener(ctx)
} Defensive patterns
Strategy: type-guard
Validate before calling
if conn.GetStatus() != wslconn.Status_Connecting {
return nil // listener can only be opened while connecting
} Type guard
func canOpenListener(s string) bool { return s == wslconn.Status_Connecting } Try / catch
err := conn.OpenDomainSocketListener(ctx)
if err != nil && strings.Contains(err.Error(), "cannot open domain socket") {
// conn already past Connecting; skip or wait for status transition
} Prevention
- Always check GetStatus() == Status_Connecting before enabling wsh
- Serialize enable flows with a mutex/flag to prevent double invocation
- Treat 'already connected' as success rather than an error path
When it happens
Trigger: tryEnableWsh calls OpenDomainSocketListener on a conn whose Status is not Status_Connecting — e.g. already connected, or a concurrent routine changed the status first.
Common situations: Calling tryEnableWsh twice concurrently; wsh already enabled and connected; connection in error/disconnected state after a drop; racing an in-flight reconnect.
Related errors
- encryption is not available
- wsl connection %s not connected, cannot start shellproc
- job is not connected (status: %s)
- cannot connect to %q when status is %q
- error opening domain socket listener: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/6301ce454bb7af36.
Report an issue: GitHub.