wavetermdev/waveterm · error
disconnecting %q error: %w
Error message
disconnecting %q error: %w
What it means
Returned by connDisconnectRun when the ConnDisconnectCommand RPC fails for the given connection name (10-second timeout). The wrapper identifies the connection with %q and wraps the underlying error. The disconnect itself did not complete on the server.
Source
Thrown at cmd/wsh/cmd/wshcmd-conn.go:155
ConnName: connName,
LogBlockId: RpcContext.BlockId,
}
err := wshclient.ConnReinstallWshCommand(RpcClient, data, &wshrpc.RpcOpts{Timeout: 60000})
if err != nil {
return fmt.Errorf("reinstalling connection: %w", err)
}
WriteStdout("wsh reinstalled on connection %q\n", connName)
return nil
}
func connDisconnectRun(cmd *cobra.Command, args []string) error {
connName := args[0]
if err := validateConnectionName(connName); err != nil {
return err
}
err := wshclient.ConnDisconnectCommand(RpcClient, connName, &wshrpc.RpcOpts{Timeout: 10000})
if err != nil {
return fmt.Errorf("disconnecting %q error: %w", connName, err)
}
WriteStdout("disconnected %q\n", connName)
return nil
}
func connDisconnectAllRun(cmd *cobra.Command, args []string) error {
allConns, err := getAllConnStatus()
if err != nil {
return err
}
for _, conn := range allConns {
if conn.Status != "connected" {
continue
}
err := wshclient.ConnDisconnectCommand(RpcClient, conn.Connection, &wshrpc.RpcOpts{Timeout: 10000})
if err != nil {
WriteStdout("error disconnecting %q: %v\n", conn.Connection, err)
} else {View on GitHub (pinned to a4447c1563)
Solutions
- Verify the connection name with `wsh conn status`; correct any typo
- Retry once — transient RPC timeouts are common; if persistent, the server may be overloaded
- Check whether the connection is actually already disconnected (the goal may already be met)
- Inspect the wrapped inner error for the server-side root cause
Example fix
// before wsh conn disconnect prod could not disconnect // after wsh conn status # confirm exact name wsh conn disconnect myserver
Defensive patterns
Strategy: retry
Validate before calling
status, err := wshclient.ConnStatusCommand(RpcClient, nil)
if err == nil && !slices.ContainsFunc(status, func(c wshrpc.ConnStatusEntry) bool { return c.ConnName == connName && c.Connected }) {
return nil // already disconnected, nothing to do
} Try / catch
err := wshclient.ConnDisconnectCommand(RpcClient, connName, &wshrpc.RpcOpts{Timeout: 10000})
if err != nil {
if errors.Is(err, context.DeadlineExceeded) {
// one retry, then surface
}
return fmt.Errorf("disconnecting %q error: %w", connName, err)
} Prevention
- Validate the connection name via `wsh conn status` before disconnecting
- Treat 'already disconnected' outcomes as success in scripts (idempotency)
- Retry once on timeout; the 10s budget is tight under load
- Quote names exactly — typos are the most common cause
When it happens
Trigger: Running `wsh conn disconnect <conn>` when the RPC errors: connection does not exist server-side, timeout exceeded (10s), or the server rejects the disconnect request.
Common situations: Disconnecting an already-closed connection, typos in the connection name, slow/unresponsive server exceeding the 10s timeout.
Related errors
- reinstalling connection: %w
- ensuring connection: %w
- reading terminal output: %w
- deleting secret: %w
- opening secrets UI: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/9637268db7dd03d5.
Report an issue: GitHub.