{"record":{"id":"f034a70499a2a147","repo":"wavetermdev/waveterm","slug":"getting-block-info-w","errorCode":null,"errorMessage":"getting block info: %w","messagePattern":"getting block info: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-web.go","lineNumber":62,"sourceCode":"func 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}\n\toutput, err := wshclient.WebSelectorCommand(RpcClient, data, &wshrpc.RpcOpts{\n\t\tRoute:   wshutil.ElectronRoute,\n\t\tTimeout: 5000,\n\t})","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-web.go#L44-L80","documentation":"webGetRun resolves a block by --blockid and calls BlockInfoCommand over the wsh RPC. When the underlying RPC to fetch block info fails (block does not exist, connection to the Wave Terminal server failed, or permission/RPC error), the failure is wrapped with \"getting block info:\". This wrapper preserves the root cause so the CLI user can see why block metadata could not be retrieved.","triggerScenarios":"Calling `wsh web get <selector> --blockid <id>` where the blockid does not resolve to an existing block, the wsh client is not connected to a running Wave Terminal, or BlockInfoCommand returns an RPC error (e.g. stale OID after the block was closed).","commonSituations":"Typing an invalid or truncated blockid; referencing a block that was closed; running wsh from a terminal without the WAVETERM connection context; the Wave app was restarted so block OIDs changed.","solutions":["Verify the blockid is correct with `wsh ls` or by re-copying it from the Wave UI","Confirm the Wave Terminal app is running and the wsh client is connected (check WAVETERM_* env vars / connection)","Close and re-run the command against a still-open web block"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if RpcContext == nil || RpcClient == nil { return errors.New(\"wsh not connected\") }\n// confirm block exists first: wsh ls","typeGuard":null,"tryCatchPattern":"blockInfo, err := wshclient.BlockInfoCommand(RpcClient, oid, nil)\nif err != nil {\n    return fmt.Errorf(\"getting block info: %w\", err)\n}","preventionTips":["Verify blockids with `wsh ls` before use","Keep the Wave session open while running wsh commands","Check RPC connectivity with a cheap command before batch operations"],"tags":["cli","rpc","wave-terminal"],"backgroundTag":"block-info-rpc-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}