{"record":{"id":"495ed5a199e49479","repo":"wavetermdev/waveterm","slug":"badge-oref-must-be-a-block-or-tab-got-q","errorCode":null,"errorMessage":"badge oref must be a block or tab (got %q)","messagePattern":"badge oref must be a block or tab \\(got %q\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-badge.go","lineNumber":62,"sourceCode":"\nfunc badgeRun(cmd *cobra.Command, args []string) (rtnErr error) {\n\tdefer func() {\n\t\tsendActivity(\"badge\", rtnErr == nil)\n\t}()\n\n\tif badgePid > 0 && runtime.GOOS == \"windows\" {\n\t\treturn fmt.Errorf(\"--pid flag is not supported on Windows\")\n\t}\n\tif badgePid > 0 && !cmd.Flags().Changed(\"priority\") {\n\t\tbadgePriority = 5\n\t}\n\n\toref, err := resolveBlockArg()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"resolving block: %v\", err)\n\t}\n\tif oref.OType != waveobj.OType_Block && oref.OType != waveobj.OType_Tab {\n\t\treturn fmt.Errorf(\"badge oref must be a block or tab (got %q)\", oref.OType)\n\t}\n\n\tvar eventData baseds.BadgeEvent\n\teventData.ORef = oref.String()\n\n\tif badgeClear {\n\t\teventData.Clear = true\n\t} else {\n\t\ticon := \"circle-small\"\n\t\tif len(args) > 0 {\n\t\t\ticon = args[0]\n\t\t}\n\t\tbadgeId, err := uuid.NewV7()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"generating badge id: %v\", err)\n\t\t}\n\t\teventData.Badge = &baseds.Badge{\n\t\t\tBadgeId:   badgeId.String(),","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-badge.go#L44-L80","documentation":"After resolving, badgeRun validates that the resolved oref is a block or a tab, since badges attach to those object types. Any other resolved type (e.g. a window or workspace reference) triggers this error showing the actual type.","triggerScenarios":"Passing a reference that resolves to a non-block/non-tab Wave object — for example a workspace or window oref — to `wsh badge`.","commonSituations":"Copy-pasting an oref of the wrong type (workspace instead of block); scripting that blindly forwards a generic oref variable into the badge command.","solutions":["Pass a block or tab reference: verify the oref prefix is `block:` or `tab:`.","Re-copy the oref from the target block/tab in Wave Terminal.","Adjust scripts to filter to block/tab types before calling wsh badge."],"exampleFix":"// before\nwsh badge workspace:abc \"info\"  # badge oref must be a block or tab (got \"workspace\")\n\n// after\nwsh badge block:def456 \"info\"","handlingStrategy":"validation","validationCode":"if !strings.HasPrefix(orefStr, \"block:\") && !strings.HasPrefix(orefStr, \"tab:\") {\n    // reject before calling wsh badge\n}","typeGuard":"func isBlockOrTabORef(o waveobj.ORef) bool {\n    return o.OType == waveobj.OType_Block || o.OType == waveobj.OType_Tab\n}","tryCatchPattern":null,"preventionTips":["Only pass block: or tab: orefs to wsh badge.","Type-check oref variables in scripts before forwarding them.","Re-copy the oref if unsure of its source type."],"tags":["cli","validation","oref"],"backgroundTag":"invalid-object-type","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}