{"record":{"id":"2a0aa658a8ed91ac","repo":"wavetermdev/waveterm","slug":"resolving-r-blockid-w","errorCode":null,"errorMessage":"resolving -r blockid: %w","messagePattern":"resolving -r blockid: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-web.go","lineNumber":108,"sourceCode":"\t} else {\n\t\tfor _, item := range output {\n\t\t\tWriteStdout(\"%s\\n\", item)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc webOpenRun(cmd *cobra.Command, args []string) (rtnErr error) {\n\tdefer func() {\n\t\tsendActivity(\"web\", rtnErr == nil)\n\t}()\n\n\tvar replaceBlockORef *waveobj.ORef\n\tif webOpenReplaceBlock != \"\" {\n\t\tvar err error\n\t\treplaceBlockORef, err = resolveSimpleId(webOpenReplaceBlock)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"resolving -r blockid: %w\", err)\n\t\t}\n\t}\n\tif replaceBlockORef != nil && webOpenMagnified {\n\t\treturn fmt.Errorf(\"cannot use --replace and --magnified together\")\n\t}\n\n\ttabId := getTabIdFromEnv()\n\tif tabId == \"\" {\n\t\treturn fmt.Errorf(\"no WAVETERM_TABID env var set\")\n\t}\n\n\twshCmd := wshrpc.CommandCreateBlockData{\n\t\tTabId: tabId,\n\t\tBlockDef: &waveobj.BlockDef{\n\t\t\tMeta: map[string]any{\n\t\t\t\twaveobj.MetaKey_View: \"web\",\n\t\t\t\twaveobj.MetaKey_Url:  args[0],\n\t\t\t},","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-web.go#L90-L126","documentation":"webOpenRun resolves the -r/--replace blockid argument with resolveSimpleId before opening the URL. If that id cannot be parsed or resolved into an ORef, the failure is wrapped with \"resolving -r blockid:\".","triggerScenarios":"`wsh web open <url> --replace <bad-id>` where the id is empty-formatted, not a valid OID or block id, or refers to a nonexistent block.","commonSituations":"Typo in the block id; passing a tab id instead of a block id; stale id from a closed block.","solutions":["Verify the block id via `wsh ls` and pass the full valid OID","Omit --replace to create a brand-new block instead of replacing one","Ensure the target block is still open in the connected Wave session"],"exampleFix":"// before\nwsh web open https://example.com --replace 1234\n// after\nwsh web open https://example.com --replace <full-valid-block-oid>","handlingStrategy":"validation","validationCode":"if webOpenReplaceBlock != \"\" {\n    if _, err := resolveSimpleId(webOpenReplaceBlock); err != nil {\n        return fmt.Errorf(\"invalid --replace blockid: %w\", err)\n    }\n}","typeGuard":"func isValidBlockId(id string) bool {\n    _, err := resolveSimpleId(id)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["Copy full OIDs from `wsh ls` rather than typing them","Validate ids before scripting batch opens","Resolve ids in the same live Wave session that will execute the open"],"tags":["cli","argument-parsing","wave-terminal"],"backgroundTag":"invalid-block-id","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}