wavetermdev/waveterm · error

connection %s not found

Error message

connection %s not found

What it means

DismissWshFailCommand clears a recorded wsh failure on a connection. After parsing the connection name into opts and fetching the live connection via conncontroller.GetConn, this error is thrown when no connection object exists for that name. It means dismissal was attempted against an unknown or not-currently-open connection.

Source

Thrown at pkg/wshrpc/wshserver/wshserver.go:777

 */
func (ws *WshServer) DismissWshFailCommand(ctx context.Context, connName string) error {
	if strings.HasPrefix(connName, "wsl://") {
		distroName := strings.TrimPrefix(connName, "wsl://")
		conn := wslconn.GetWslConn(distroName)
		if conn == nil {
			return fmt.Errorf("connection not found: %s", connName)
		}
		conn.ClearWshError()
		conn.FireConnChangeEvent()
		return nil
	}
	opts, err := remote.ParseOpts(connName)
	if err != nil {
		return err
	}
	conn := conncontroller.GetConn(opts)
	if conn == nil {
		return fmt.Errorf("connection %s not found", connName)
	}
	conn.ClearWshError()
	conn.FireConnChangeEvent()
	return nil
}

func (ws *WshServer) NotifySystemResumeCommand(ctx context.Context) error {
	log.Printf("NotifySystemResumeCommand called\n")
	return nil
}

func (ws *WshServer) FindGitBashCommand(ctx context.Context, rescan bool) (string, error) {
	fullConfig := wconfig.GetWatcher().GetFullConfig()
	return shellutil.FindGitBash(&fullConfig, rescan), nil
}

func waveFileToWaveFileInfo(wf *filestore.WaveFile) *wshrpc.WaveFileInfo {
	return &wshrpc.WaveFileInfo{

View on GitHub (pinned to a4447c1563)

Solutions

  1. Check the connection name against conncontroller's active connection list (or `wsh conn ls`-style listing) before dismissing.
  2. If the connection is gone, the wsh error no longer applies — drop the banner/state instead of calling dismiss.
  3. Reconnect to the connection first, then dismiss the wsh failure.
  4. Fix the connName in the caller (config or saved reference).

Example fix

// before
conncontroller.DismissWshFail(ctx, "prod-server") // typo: actual name "prodserver"
// after
connName := "prodserver"
if conncontroller.GetConn(remote.ParseOpts(connName)) != nil {
    conncontroller.DismissWshFail(ctx, connName)
}
Defensive patterns

Strategy: validation

Validate before calling

opts, err := remote.ParseOpts(connName)
if err != nil || conncontroller.GetConn(opts) == nil {
    // skip dismissal: connection not active
} else {
    _ = wshclient.DismissWshFailCommand(ctx, connName, nil)
}

Type guard

func connIsActive(connName string) bool {
    opts, err := remote.ParseOpts(connName)
    return err == nil && conncontroller.GetConn(opts) != nil
}

Try / catch

err := wshclient.DismissWshFailCommand(ctx, connName, nil)
if err != nil && strings.Contains(err.Error(), "not found") {
    // connection already gone: clear local banner state instead
}

Prevention

When it happens

Trigger: Calling DismissWshFailCommand with a connName that has no active connection: typo in the connection name, connection was closed/removed, or the connection was never established.

Common situations: UI showing a stale wsh-error banner for a connection that has since been deleted; calling dismiss after the connection dropped and was garbage-collected; config renamed the connection profile.

Related errors


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