{"record":{"id":"24c5b1ffa1d2380d","repo":"wavetermdev/waveterm","slug":"publishing-badge-event-v","errorCode":null,"errorMessage":"publishing badge event: %v","messagePattern":"publishing badge event: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-badge.go","lineNumber":96,"sourceCode":"\t\t}\n\t\teventData.Badge = &baseds.Badge{\n\t\t\tBadgeId:   badgeId.String(),\n\t\t\tIcon:      icon,\n\t\t\tColor:     badgeColor,\n\t\t\tPriority:  badgePriority,\n\t\t\tPidLinked: badgePid > 0,\n\t\t}\n\t}\n\n\tevent := wps.WaveEvent{\n\t\tEvent:  wps.Event_Badge,\n\t\tScopes: []string{oref.String()},\n\t\tData:   eventData,\n\t}\n\n\terr = wshclient.EventPublishCommand(RpcClient, event, &wshrpc.RpcOpts{NoResponse: true})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"publishing badge event: %v\", err)\n\t}\n\n\tif badgeBeep {\n\t\terr = wshclient.ElectronSystemBellCommand(RpcClient, &wshrpc.RpcOpts{Route: \"electron\"})\n\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,","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-badge.go#L78-L114","documentation":"After composing the BadgeEvent, badgeRun publishes it with EventPublishCommand (NoResponse). If the publish RPC fails, the error is wrapped as \"publishing badge event: %v\". This is the step that actually delivers the badge to the Wave UI.","triggerScenarios":"EventPublishCommand returns an error: no connection to the Wave app, the event bus rejects the publish, or the scoped route (oref) is unreachable.","commonSituations":"Wave Terminal not running or just restarted; connection between wsh CLI and the Wave server dropped; publishing to an oref whose block/tab no longer exists.","solutions":["Verify Wave Terminal is running and reachable, then retry the badge command.","Re-check the block/tab oref is still valid (block not closed).","Inspect the wrapped cause for connection vs. routing failures.","Reconnect the wsh session (rerun from a live Wave block)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := wshclient.EventPublishCommand(RpcClient, event, &wshrpc.RpcOpts{NoResponse: true})\nif err != nil {\n    // check Wave is running; retry publish\n}","preventionTips":["Verify Wave Terminal connectivity before publishing events.","Confirm the scoped oref still exists.","Retry on transient event-bus failures."],"tags":["rpc","events","wsh"],"backgroundTag":"rpc-call-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}