wavetermdev/waveterm · error
getting wsl connection status: %w
Error message
getting wsl connection status: %w
What it means
Returned by getAllConnStatus when the WSL status RPC (wshclient.WslStatusCommand) fails while collecting the full list of SSH and WSL connections. It wraps the underlying RPC error with the "getting wsh connection status" prefix. The command cannot report connection status without both SSH and WSL responses, so it fails fast instead of returning partial data.
Source
Thrown at cmd/wsh/cmd/wshcmd-conn.go:98
if !strings.HasPrefix(name, "wsl://") {
_, err := remote.ParseOpts(name)
if err != nil {
return fmt.Errorf("cannot parse connection name: %w", err)
}
}
return nil
}
func getAllConnStatus() ([]wshrpc.ConnStatus, error) {
var allResp []wshrpc.ConnStatus
sshResp, err := wshclient.ConnStatusCommand(RpcClient, nil)
if err != nil {
return nil, fmt.Errorf("getting ssh connection status: %w", err)
}
allResp = append(allResp, sshResp...)
wslResp, err := wshclient.WslStatusCommand(RpcClient, nil)
if err != nil {
return nil, fmt.Errorf("getting wsl connection status: %w", err)
}
allResp = append(allResp, wslResp...)
return allResp, nil
}
func connStatusRun(cmd *cobra.Command, args []string) error {
allResp, err := getAllConnStatus()
if err != nil {
return err
}
if len(allResp) == 0 {
WriteStdout("no connections\n")
return nil
}
WriteStdout("%-30s %-12s\n", "connection", "status")
WriteStdout("----------------------------------------------\n")
for _, conn := range allResp {
str := fmt.Sprintf("%-30s %-12s", conn.Connection, conn.Status)View on GitHub (pinned to a4447c1563)
Solutions
- Check that a server connection is available and the RPC client (RpcClient) is connected before running the command
- Re-run with a shorter/longer timeout or retry; transient RPC failures are common
- Inspect the wrapped inner error (%w) for the root cause (timeout vs. transport vs. server-side failure)
- On Windows, verify WSL is installed (`wsl --status`) and distros are healthy
Example fix
// before
wslResp, err := wshclient.WslStatusCommand(RpcClient, nil)
if err != nil {
return nil, fmt.Errorf("getting wsh connection status: %w", err)
}
// after
wslResp, err := wshclient.WslStatusCommand(RpcClient, nil)
if err != nil {
log.Printf("wsl status unavailable, returning ssh-only status: %v", err)
return allResp, nil // degrade gracefully instead of failing the whole listing
} Defensive patterns
Strategy: retry
Validate before calling
if RpcClient == nil || RpcClient.RouteID == "" {
return fmt.Errorf("no rpc client connected; cannot fetch wsl status")
} Try / catch
resp, err := getAllConnStatus()
if err != nil {
var rpcErr *wshrpc.RpcError
if errors.As(err, &rpcErr) {
// retry or surface RPC-specific cause
}
return fmt.Errorf("conn status unavailable: %w", err)
} Prevention
- Ensure the RPC client is connected before invoking conn status commands
- Retry transient RPC failures with backoff
- Monitor WSL health on Windows hosts that depend on it
- Log the wrapped inner error to distinguish timeout vs transport failures
When it happens
Trigger: Running `wsh conn status` (or `wsh conn disconnect --all` via connDisconnectAllRun) when WslStatusCommand returns an error: the underlying RPC times out, the wshserver side is unreachable, or the WSL status provider itself errors.
Common situations: No active connection/router to the server, a stale or dead RPC route, WSL not installed or misconfigured on Windows hosts, or RPC timeout under load.
Related errors
- setting connection in block: %w
- playing system bell: %v
- watching pid: %v
- reinstalling connection: %w
- disconnecting %q error: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/1f14ec7e68ad3ade.
Report an issue: GitHub.