{"record":{"id":"f8d6ef7db8eb9210","repo":"wavetermdev/waveterm","slug":"badgeid-is-required","errorCode":null,"errorMessage":"badgeid is required","messagePattern":"badgeid is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wshrpc/wshremote/wshremote.go","lineNumber":149,"sourceCode":"\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{\n\t\t\t\t\tORef:      orefStr,\n\t\t\t\t\tClearById: data.BadgeId,\n\t\t\t\t},","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wshrpc/wshremote/wshremote.go#L131-L167","documentation":"Returned when the request requires a badgeid but none was supplied.","triggerScenarios":"Calling BadgeWatchPidCommand with CommandBadgeWatchPidData.BadgeId == \"\".","commonSituations":"Hand-constructed command data omitting BadgeId; older clients/versions whose payload schema lacked badgeid.","solutions":["Set a unique BadgeId when building the command data","Validate BadgeId != \"\" in the caller before the RPC","Check client/server schema versions match"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if data.BadgeId == \"\" {\n    return fmt.Errorf(\"badgeid must be a non-empty unique identifier\")\n}","typeGuard":null,"tryCatchPattern":"if err := BadgeWatchPidCommand(ctx, data); err != nil {\n    if strings.Contains(err.Error(), \"badgeid is required\") {\n        return fmt.Errorf(\"caller bug: badge watch missing badgeid\")\n    }\n    return err\n}","preventionTips":["Assign a stable unique BadgeId per badge watch","Keep client payload schema in sync with server expectations","Unit-test RPC data construction helpers for required fields"],"tags":["go","validation","rpc"],"backgroundTag":"missing-required-argument","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}