{"record":{"id":"1d46e488d6f08d37","repo":"wavetermdev/waveterm","slug":"watching-pid-v","errorCode":null,"errorMessage":"watching pid: %v","messagePattern":"watching pid: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-badge.go","lineNumber":119,"sourceCode":"\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"playing system bell: %v\", err)\n\t\t}\n\t}\n\n\tif badgePid > 0 && eventData.Badge != nil {\n\t\tconn := RpcContext.Conn\n\t\tif conn == \"\" {\n\t\t\tconn = wshrpc.LocalConnName\n\t\t}\n\t\tconnRoute := wshutil.MakeConnectionRouteId(conn)\n\t\twatchData := wshrpc.CommandBadgeWatchPidData{\n\t\t\tPid:     badgePid,\n\t\t\tORef:    *oref,\n\t\t\tBadgeId: eventData.Badge.BadgeId,\n\t\t}\n\t\terr = wshclient.BadgeWatchPidCommand(RpcClient, watchData, &wshrpc.RpcOpts{Route: connRoute})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"watching pid: %v\", err)\n\t\t}\n\t}\n\n\tif badgeClear {\n\t\tfmt.Printf(\"badge cleared\\n\")\n\t} else {\n\t\tfmt.Printf(\"badge set\\n\")\n\t}\n\treturn nil\n}\n","sourceCodeStart":101,"sourceCodeEnd":130,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-badge.go#L101-L130","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the connection is alive (`wsh conn status`) and reconnect if needed","Re-run the command — the target block may have been transiently unavailable","Confirm the remote Wave Terminal/wsh version supports badge watch RPC; upgrade both sides","Check that the --pid process actually exists on the target host"],"exampleFix":"// before\nerr = wshclient.BadgeWatchPidCommand(RpcClient, watchData, &wshrpc.RpcOpts{Route: connRoute})\n// after\nstatus, serr := wshclient.ConnStatusCommand(RpcClient, nil)\nif serr == nil && connRoute != \"\" {\n    err = wshclient.BadgeWatchPidCommand(RpcClient, watchData, &wshrpc.RpcOpts{Route: connRoute, Timeout: 10000})\n}","handlingStrategy":"retry","validationCode":"// check connection before running badge watch\nstatus, err := wshclient.ConnStatusCommand(RpcClient, nil)\nif err != nil {\n    return fmt.Errorf(\"no active connection for badge watch: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := runBadgeWatch(); err != nil {\n    if strings.Contains(err.Error(), \"watching pid:\") {\n        // reconnect and retry once\n    }\n}","preventionTips":["Verify connRoute points to a live block before issuing the RPC","Reconnect dropped SSH/WSL sessions before running wsh badge","Keep client and remote wsh versions in sync"],"tags":["rpc","wsh","cli","badge","connection"],"backgroundTag":"rpc-route-unavailable","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}