{"record":{"id":"1e89e8d097e98b3d","repo":"wavetermdev/waveterm","slug":"oref-is-required","errorCode":null,"errorMessage":"oref is required","messagePattern":"oref is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wshrpc/wshremote/wshremote.go","lineNumber":146,"sourceCode":"}\n\nfunc (impl *ServerImpl) getWshPath() (string, error) {\n\tif impl.IsLocal {\n\t\treturn filepath.Join(wavebase.GetWaveDataDir(), \"bin\", \"wsh\"), nil\n\t}\n\twshPath, err := wavebase.ExpandHomeDir(\"~/.waveterm/bin/wsh\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"cannot expand wsh path: %w\", err)\n\t}\n\treturn wshPath, nil\n}\n\nfunc (impl *ServerImpl) BadgeWatchPidCommand(ctx context.Context, data wshrpc.CommandBadgeWatchPidData) error {\n\tif data.Pid <= 0 {\n\t\treturn fmt.Errorf(\"invalid pid: %d\", data.Pid)\n\t}\n\tif data.ORef.IsEmpty() {\n\t\treturn fmt.Errorf(\"oref is required\")\n\t}\n\tif data.BadgeId == \"\" {\n\t\treturn fmt.Errorf(\"badgeid is required\")\n\t}\n\tgo func() {\n\t\tdefer func() {\n\t\t\tpanichandler.PanicHandler(\"BadgeWatchPidCommand\", recover())\n\t\t}()\n\t\tfor {\n\t\t\ttime.Sleep(time.Second)\n\t\t\tif unixutil.IsPidRunning(data.Pid) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\torefStr := data.ORef.String()\n\t\t\tevent := wps.WaveEvent{\n\t\t\t\tEvent:  wps.Event_Badge,\n\t\t\t\tScopes: []string{orefStr},\n\t\t\t\tData: baseds.BadgeEvent{","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wshrpc/wshremote/wshremote.go#L128-L164","documentation":"Returned when the request requires an oref (object reference) but none was supplied.","triggerScenarios":"Calling BadgeWatchPidCommand with CommandBadgeWatchPidData.ORef left as zero value (empty oref).","commonSituations":"Constructing the command data struct and forgetting to set ORef from the block context; deserializing partial JSON payloads.","solutions":["Populate ORef from the current block/conn context before calling","Validate !oRef.IsEmpty() in the sender","Ensure serialization includes the oref field"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if data.ORef.IsEmpty() {\n    return fmt.Errorf(\"oref must be set from block context before watching badge\")\n}","typeGuard":null,"tryCatchPattern":"if err := BadgeWatchPidCommand(ctx, data); err != nil {\n    if strings.Contains(err.Error(), \"oref is required\") {\n        return fmt.Errorf(\"caller bug: badge watch missing oref\")\n    }\n    return err\n}","preventionTips":["Always derive ORef from the active block/conn context","Include oref in serialized command payloads","Add sender-side assertions on required RPC fields"],"tags":["go","validation","rpc","oref"],"backgroundTag":"missing-required-argument","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}