wavetermdev/waveterm · error

block %s is not a terminal block (view type: %s)

Error message

block %s is not a terminal block (view type: %s)

What it means

After fetching block metadata, wsh validates that the block's meta[MetaKey_View] equals "term". If the key is missing or any non-"term" value (e.g. "preview", "web"), it refuses to fetch scrollback with this error.

Source

Thrown at cmd/wsh/cmd/wshcmd-termscrollback.go:68

	// Resolve the block argument
	fullORef, err := resolveBlockArg()
	if err != nil {
		return err
	}

	// Get block metadata to verify it's a terminal block
	metaData, err := wshclient.GetMetaCommand(RpcClient, wshrpc.CommandGetMetaData{
		ORef: *fullORef,
	}, &wshrpc.RpcOpts{Timeout: 2000})
	if err != nil {
		return fmt.Errorf("error getting block metadata: %w", err)
	}

	// Check if the block is a terminal block
	viewType, ok := metaData[waveobj.MetaKey_View].(string)
	if !ok || viewType != "term" {
		return fmt.Errorf("block %s is not a terminal block (view type: %s)", fullORef.OID, viewType)
	}

	// Make the RPC call to get scrollback
	scrollbackData := wshrpc.CommandTermGetScrollbackLinesData{
		LineStart:   termScrollbackLineStart,
		LineEnd:     termScrollbackLineEnd,
		LastCommand: termScrollbackLastCmd,
	}

	result, err := wshclient.TermGetScrollbackLinesCommand(RpcClient, scrollbackData, &wshrpc.RpcOpts{
		Route:   wshutil.MakeFeBlockRouteId(fullORef.OID),
		Timeout: 5000,
	})
	if err != nil {
		return fmt.Errorf("error getting terminal scrollback: %w", err)
	}

	// Format the output

View on GitHub (pinned to a4447c1563)

Solutions

  1. Target a terminal block: get the correct OID from the Wave UI block menu.
  2. Check the block's meta with `wsh getmeta <oid>` and confirm view == "term".
  3. If the block should be a terminal but isn't, fix its meta (`wsh setmeta <oid> view:term`).
Defensive patterns

Strategy: type-guard

Validate before calling

meta, _ := wshclient.GetMetaCommand(RpcClient, wshrpc.CommandGetMetaData{ORef: *fullORef}, nil)
if v, _ := meta[waveobj.MetaKey_View].(string); v != "term" {
	fmt.Fprintf(os.Stderr, "block %s is not a terminal block\n", fullORef.OID)
	os.Exit(1)
}

Type guard

func isTerminalBlock(meta map[string]any) bool {
	v, ok := meta[waveobj.MetaKey_View].(string)
	return ok && v == "term"
}

Try / catch

viewType, ok := metaData[waveobj.MetaKey_View].(string)
if !ok || viewType != "term" {
	// handle non-terminal block: exit gracefully or prompt for a different OID
}

Prevention

When it happens

Trigger: `wsh termescrollback <oid>` on a block whose view type is not a terminal — passing a preview/editor/web block OID, or a typo'd OID that resolves to the wrong block.

Common situations: Copying an OID from the wrong block; pointing the command at a config or file block; a block whose meta was changed so the view key no longer reads "term".

Related errors


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