wavetermdev/waveterm · error

watching pid: %v

Error message

watching pid: %v

What it means

Error returned by the `wsh badge` command when the client-side RPC call BadgeWatchPidCommand fails after the badge data has been assembled. It wraps the underlying RPC error, meaning the request to watch a pid for badge updates could not be delivered to the connected Wave terminal. The failure is in the transport/routing layer, not in the badge data itself.

Source

Thrown at cmd/wsh/cmd/wshcmd-badge.go:119

		if err != nil {
			return fmt.Errorf("playing system bell: %v", err)
		}
	}

	if badgePid > 0 && eventData.Badge != nil {
		conn := RpcContext.Conn
		if conn == "" {
			conn = wshrpc.LocalConnName
		}
		connRoute := wshutil.MakeConnectionRouteId(conn)
		watchData := wshrpc.CommandBadgeWatchPidData{
			Pid:     badgePid,
			ORef:    *oref,
			BadgeId: eventData.Badge.BadgeId,
		}
		err = wshclient.BadgeWatchPidCommand(RpcClient, watchData, &wshrpc.RpcOpts{Route: connRoute})
		if err != nil {
			return fmt.Errorf("watching pid: %v", err)
		}
	}

	if badgeClear {
		fmt.Printf("badge cleared\n")
	} else {
		fmt.Printf("badge set\n")
	}
	return nil
}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Verify the connection is alive (`wsh conn status`) and reconnect if needed
  2. Re-run the command — the target block may have been transiently unavailable
  3. Confirm the remote Wave Terminal/wsh version supports badge watch RPC; upgrade both sides
  4. Check that the --pid process actually exists on the target host

Example fix

// before
err = wshclient.BadgeWatchPidCommand(RpcClient, watchData, &wshrpc.RpcOpts{Route: connRoute})
// after
status, serr := wshclient.ConnStatusCommand(RpcClient, nil)
if serr == nil && connRoute != "" {
    err = wshclient.BadgeWatchPidCommand(RpcClient, watchData, &wshrpc.RpcOpts{Route: connRoute, Timeout: 10000})
}
Defensive patterns

Strategy: retry

Validate before calling

// check connection before running badge watch
status, err := wshclient.ConnStatusCommand(RpcClient, nil)
if err != nil {
    return fmt.Errorf("no active connection for badge watch: %w", err)
}

Try / catch

if err := runBadgeWatch(); err != nil {
    if strings.Contains(err.Error(), "watching pid:") {
        // reconnect and retry once
    }
}

Prevention

When it happens

Trigger: Running `wsh badge` with --pid (badgePid set) when the RPC route to the target block/connection is unavailable, the connection is down, the block has closed, or the remote wsh server does not support the BadgeWatchPid RPC (version mismatch).

Common situations: SSH/WSL connection dropped mid-command; targeting a stale connRoute after the tab was closed; older Wave Terminal on the remote side without badge watch support; network interruption to a remote host.

Related errors


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