wavetermdev/waveterm · error

block is not a web block

Error message

block %s is not a web block

What it means

webGetRun only operates on web-view blocks. After fetching block info it checks blockInfo.Block.Meta[MetaKey_View] == "web"; if the target block is any other view type (terminal, preview, editor, etc.) it rejects the operation with this error naming the block OID.

Solutions

  1. Pass the OID of an actual web block (open a URL in Wave to create one)
  2. Check the block's view meta: the block meta key "view" must equal "web"
  3. Use the correct wsh subcommand for non-web blocks

Example fix

// before
wsh web get "#content" --blockid terminal-oid
// after
wsh web get "#content" --blockid web-block-oid
Defensive patterns

Strategy: validation

Validate before calling

info, err := wshclient.BlockInfoCommand(RpcClient, oid, nil)
if err == nil && info.Block.Meta.GetString(waveobj.MetaKey_View, "") != "web" {
    return fmt.Errorf("block %s is not a web block", oid)
}

Type guard

func isWebBlock(info *wshrpc.RespBlockInfo) bool {
    return info != nil && info.Block != nil && info.Block.Meta.GetString(waveobj.MetaKey_View, "") == "web"
}

Prevention

When it happens

Trigger: Running `wsh web get <selector> --blockid <oid>` where the OID points to a block whose meta view is not "web" (e.g. a terminal or preview block).

Common situations: Copy-pasting the wrong block id from `wsh ls`; assuming any block supports DOM selectors; targeting a webview block created before the view meta was set to "web".

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/709ae6140dc4d443. Report an issue: GitHub.

Appendix: source

Thrown at cmd/wsh/cmd/wshcmd-web.go:65

	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,
	})
	if err != nil {
		return err
	}

View on GitHub (pinned to a4447c1563)