{"record":{"id":"0399bd4239d59af2","repo":"wavetermdev/waveterm","slug":"resolving-blockid-w","errorCode":null,"errorMessage":"resolving blockid: %w","messagePattern":"resolving blockid: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-web.go","lineNumber":58,"sourceCode":"var webGetJson bool\nvar webOpenMagnified bool\nvar webOpenReplaceBlock string\n\nfunc init() {\n\twebOpenCmd.Flags().BoolVarP(&webOpenMagnified, \"magnified\", \"m\", false, \"open view in magnified mode\")\n\twebOpenCmd.Flags().StringVarP(&webOpenReplaceBlock, \"replace\", \"r\", \"\", \"replace block\")\n\twebCmd.AddCommand(webOpenCmd)\n\twebGetCmd.Flags().BoolVarP(&webGetInner, \"inner\", \"\", false, \"get inner html (instead of outer)\")\n\twebGetCmd.Flags().BoolVarP(&webGetAll, \"all\", \"\", false, \"get all matches (querySelectorAll)\")\n\twebGetCmd.Flags().BoolVarP(&webGetJson, \"json\", \"\", false, \"output as json\")\n\twebCmd.AddCommand(webGetCmd)\n\trootCmd.AddCommand(webCmd)\n}\n\nfunc webGetRun(cmd *cobra.Command, args []string) error {\n\tfullORef, err := resolveBlockArg()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"resolving blockid: %w\", err)\n\t}\n\tblockInfo, err := wshclient.BlockInfoCommand(RpcClient, fullORef.OID, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting block info: %w\", err)\n\t}\n\tif blockInfo.Block.Meta.GetString(waveobj.MetaKey_View, \"\") != \"web\" {\n\t\treturn fmt.Errorf(\"block %s is not a web block\", fullORef.OID)\n\t}\n\tdata := wshrpc.CommandWebSelectorData{\n\t\tWorkspaceId: blockInfo.WorkspaceId,\n\t\tBlockId:     fullORef.OID,\n\t\tTabId:       blockInfo.TabId,\n\t\tSelector:    args[0],\n\t\tOpts: &wshrpc.WebSelectorOpts{\n\t\t\tInner: webGetInner,\n\t\t\tAll:   webGetAll,\n\t\t},\n\t}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-web.go#L40-L76","documentation":"`wsh web get` needs to resolve its block argument to a full ORef (object reference). resolveBlockArg failed, meaning the blockid/circuit arg could not be turned into a valid block reference before any RPC. This is a client-side resolution failure.","triggerScenarios":"Running `wsh web get <arg>` with a missing, malformed, or unresolvable block id (e.g. no blockid in env, invalid OID syntax, or the circuit syntax failing to resolve to a block).","commonSituations":"Running wsh web get outside a block context (no WAVETERM_BLOCKID), pasting a partial/truncated block id, or referencing a block that has been closed.","solutions":["Pass an explicit valid block id: `wsh web get <blockid>` from inside the target block.","Run the command from inside a Wave block so the block id env is set.","Verify the block still exists/is open in the terminal.","Check `wsh ls` output for the correct block id syntax."],"exampleFix":"// before\nwsh web get  # relies on ambient block context\n// after\nwsh web get B<oid>  # or run inside the web block","handlingStrategy":"validation","validationCode":"if os.Getenv(\"WAVETERM_BLOCKID\") == \"\" && len(args) < 1 { fatal(\"no block id supplied\") }","typeGuard":"func looksLikeOID(s string) bool { return len(s) >= 8 && !strings.ContainsAny(s, \" /\\\\t\") }","tryCatchPattern":"fullORef, err := resolveBlockArg()\nif err != nil { fmt.Fprintf(os.Stderr, \"pass an explicit blockid: %v\\n\", err); os.Exit(2) }","preventionTips":["Run `wsh web get` inside a Wave block or pass an explicit block id.","Copy block ids from `wsh ls` to avoid truncation.","Ensure the referenced block is still open."],"tags":["cli","argument-resolution","wsh","blockid"],"backgroundTag":"invalid-block-reference","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}