wavetermdev/waveterm · error
getting block info: %w
Error message
getting block info: %w
What it means
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.
Source
Thrown at cmd/wsh/cmd/wshcmd-web.go:62
func init() {
webOpenCmd.Flags().BoolVarP(&webOpenMagnified, "magnified", "m", false, "open view in magnified mode")
webOpenCmd.Flags().StringVarP(&webOpenReplaceBlock, "replace", "r", "", "replace block")
webCmd.AddCommand(webOpenCmd)
webGetCmd.Flags().BoolVarP(&webGetInner, "inner", "", false, "get inner html (instead of outer)")
webGetCmd.Flags().BoolVarP(&webGetAll, "all", "", false, "get all matches (querySelectorAll)")
webGetCmd.Flags().BoolVarP(&webGetJson, "json", "", false, "output as json")
webCmd.AddCommand(webGetCmd)
rootCmd.AddCommand(webCmd)
}
func webGetRun(cmd *cobra.Command, args []string) error {
fullORef, err := resolveBlockArg()
if err != nil {
return fmt.Errorf("resolving blockid: %w", err)
}
blockInfo, err := wshclient.BlockInfoCommand(RpcClient, fullORef.OID, nil)
if err != nil {
return fmt.Errorf("getting block info: %w", err)
}
if blockInfo.Block.Meta.GetString(waveobj.MetaKey_View, "") != "web" {
return fmt.Errorf("block %s is not a web block", fullORef.OID)
}
data := wshrpc.CommandWebSelectorData{
WorkspaceId: blockInfo.WorkspaceId,
BlockId: fullORef.OID,
TabId: blockInfo.TabId,
Selector: args[0],
Opts: &wshrpc.WebSelectorOpts{
Inner: webGetInner,
All: webGetAll,
},
}
output, err := wshclient.WebSelectorCommand(RpcClient, data, &wshrpc.RpcOpts{
Route: wshutil.ElectronRoute,
Timeout: 5000,
})View on GitHub (pinned to a4447c1563)
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
Defensive patterns
Strategy: try-catch
Validate before calling
if RpcContext == nil || RpcClient == nil { return errors.New("wsh not connected") }
// confirm block exists first: wsh ls Try / catch
blockInfo, err := wshclient.BlockInfoCommand(RpcClient, oid, nil)
if err != nil {
return fmt.Errorf("getting block info: %w", err)
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- create block failed: %v
- opening secrets UI: %w
- creating block: %w
- playing system bell: %v
- watching pid: %v
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/f034a70499a2a147.
Report an issue: GitHub.