wavetermdev/waveterm · error

reinstalling connection: %w

Error message

reinstalling connection: %w

What it means

Returned by connReinstallRun when the ConnReinstallWshCommand RPC fails after being dispatched with a 60-second timeout. It means the server could not reinstall wsh on the target connection. The wrapper preserves the underlying cause via %w.

Source

Thrown at cmd/wsh/cmd/wshcmd-conn.go:142

func connReinstallRun(cmd *cobra.Command, args []string) error {
	if len(args) != 1 {
		if RpcContext.Conn == "" {
			return fmt.Errorf("no connection specified")
		}
		args = []string{RpcContext.Conn}
	}
	connName := args[0]
	if err := validateConnectionName(connName); err != nil {
		return err
	}
	data := wshrpc.ConnExtData{
		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
}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Ensure the connection is established first (`wsh conn connect <conn>`), then retry reinstall
  2. Check the wrapped inner error for timeout vs. server-side failure and re-run with the host reachable
  3. Verify network/SSH reachability of the target host
  4. If timeouts persist, investigate the remote host's load and wsh binary permissions

Example fix

// before
wsh conn reinstall offline-host
// error: reinstalling connection: ... not connected
// after
wsh conn connect offline-host && wsh conn reinstall offline-host
Defensive patterns

Strategy: validation

Validate before calling

status, err := wshclient.ConnStatusCommand(RpcClient, nil)
if err != nil {
    return fmt.Errorf("cannot verify connection before reinstall: %w", err)
}
connected := slices.ContainsFunc(status, func(c wshrpc.ConnStatusEntry) bool {
    return c.ConnName == connName && c.Connected
})
if !connected {
    return fmt.Errorf("connection %q is not connected; run `wsh conn connect %s` first", connName, connName)
}

Try / catch

err := wshclient.ConnReinstallWshCommand(RpcClient, data, &wshrpc.RpcOpts{Timeout: 60000})
if err != nil {
    if ctxErr := context.DeadlineExceeded; errors.Is(err, ctxErr) {
        // retry with longer timeout
    }
    return fmt.Errorf("reinstalling connection: %w", err)
}

Prevention

When it happens

Trigger: Running `wsh conn reinstall <conn>` when the connection is not currently connected, the RPC times out (60s), or the server-side reinstall step fails (e.g. remote endpoint errors, permission problems).

Common situations: Targeting a disconnected or never-connected host, slow networks exceeding the 60s timeout, stale wsh binaries on the remote, or server-side install errors.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/8d3a4324794a0a46. Report an issue: GitHub.