{"record":{"id":"5ac2a00412f522bb","repo":"wavetermdev/waveterm","slug":"resolving-block-v","errorCode":null,"errorMessage":"resolving block: %v","messagePattern":"resolving block: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-badge.go","lineNumber":59,"sourceCode":"\tbadgeCmd.Flags().BoolVar(&badgeBeep, \"beep\", false, \"play system bell sound\")\n\tbadgeCmd.Flags().IntVar(&badgePid, \"pid\", 0, \"watch a pid and automatically clear the badge when it exits (default priority 5)\")\n}\n\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)","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-badge.go#L41-L77","documentation":"badgeRun resolves its positional/flag arguments into a Wave object reference (oref) via resolveBlockArg. If resolution fails — the argument doesn't match a known block, tab, or the default context is missing — the error is wrapped as \"resolving block: %v\".","triggerScenarios":"`wsh badge` run without a valid block specifier: no resolvable default block in scope, or an explicitly passed block id/ref that doesn't exist or is malformed.","commonSituations":"Running `wsh badge` from a shell not attached to any Wave block; referencing a block id from a previous Wave session (stale id); typo in the block reference.","solutions":["Run the command inside a Wave terminal block so the default block can be resolved, or pass an explicit valid block/tab reference.","List current blocks/tabs in Wave and copy the correct oref.","Verify the referenced block wasn't closed; reopen and use the new id.","Check the wrapped cause (%v) for whether the argument was empty vs. not found."],"exampleFix":"// before (no block context)\n$ wsh badge \"alert\"  # resolving block: no block found\n\n// after (explicit target)\n$ wsh badge --block tab:xyz123 \"alert\"","handlingStrategy":"validation","validationCode":"if blockRef == \"\" {\n    // pass an explicit block/tab reference or run inside a Wave block\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    return fmt.Errorf(\"resolving block: %w\", err) // surface wrapped cause to user\n}","preventionTips":["Run wsh badge inside a Wave terminal block so default resolution works.","Copy orefs fresh from Wave; stale ids fail resolution.","Validate the reference format before invoking."],"tags":["cli","wsh","block-resolution"],"backgroundTag":"block-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}