wavetermdev/waveterm · error
badge oref must be a block or tab (got %q)
Error message
badge oref must be a block or tab (got %q)
What it means
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.
Source
Thrown at cmd/wsh/cmd/wshcmd-badge.go:62
func badgeRun(cmd *cobra.Command, args []string) (rtnErr error) {
defer func() {
sendActivity("badge", rtnErr == nil)
}()
if badgePid > 0 && runtime.GOOS == "windows" {
return fmt.Errorf("--pid flag is not supported on Windows")
}
if badgePid > 0 && !cmd.Flags().Changed("priority") {
badgePriority = 5
}
oref, err := resolveBlockArg()
if err != nil {
return fmt.Errorf("resolving block: %v", err)
}
if oref.OType != waveobj.OType_Block && oref.OType != waveobj.OType_Tab {
return fmt.Errorf("badge oref must be a block or tab (got %q)", oref.OType)
}
var eventData baseds.BadgeEvent
eventData.ORef = oref.String()
if badgeClear {
eventData.Clear = true
} else {
icon := "circle-small"
if len(args) > 0 {
icon = args[0]
}
badgeId, err := uuid.NewV7()
if err != nil {
return fmt.Errorf("generating badge id: %v", err)
}
eventData.Badge = &baseds.Badge{
BadgeId: badgeId.String(),View on GitHub (pinned to a4447c1563)
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.
Example fix
// before wsh badge workspace:abc "info" # badge oref must be a block or tab (got "workspace") // after wsh badge block:def456 "info"
Defensive patterns
Strategy: validation
Validate before calling
if !strings.HasPrefix(orefStr, "block:") && !strings.HasPrefix(orefStr, "tab:") {
// reject before calling wsh badge
} Type guard
func isBlockOrTabORef(o waveobj.ORef) bool {
return o.OType == waveobj.OType_Block || o.OType == waveobj.OType_Tab
} Prevention
- 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.
When it happens
Trigger: Passing a reference that resolves to a non-block/non-tab Wave object — for example a workspace or window oref — to `wsh badge`.
Common situations: Copy-pasting an oref of the wrong type (workspace instead of block); scripting that blindly forwards a generic oref variable into the badge command.
Related errors
- unknown --view %q; try one of: term, web, preview, edit, sys
- --workspace and --window are mutually exclusive; specify onl
- cannot parse connection name: %w
- --conn parameter is required
- size must be greater than 0
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/495ed5a199e49479.
Report an issue: GitHub.