wavetermdev/waveterm · error

error getting block metadata: %w

Error message

error getting block metadata: %w

What it means

`wsh termescrollback` first fetches the target block's metadata via GetMetaCommand to verify it is a terminal block. If that RPC fails (no Wave app, bad OID, timeout beyond the 2s limit), the CLI wraps the cause with this message.

Source

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

}

func termScrollbackRun(cmd *cobra.Command, args []string) (rtnErr error) {
	defer func() {
		sendActivity("termscrollback", rtnErr == nil)
	}()

	// 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,

View on GitHub (pinned to a4447c1563)

Solutions

  1. Verify the block OID is correct and the block still exists in the Wave app.
  2. Ensure the Wave app is running and wsh is connected; retry.
  3. Increase tolerance for slow responses by checking the connection; the 2s timeout may be too short on a busy app.
Defensive patterns

Strategy: validation

Validate before calling

// resolve and sanity-check the OID before the RPC
if !isValidOID(oid) {
	return fmt.Errorf("invalid block OID: %s", oid)
}

Try / catch

metaData, err := wshclient.GetMetaCommand(RpcClient, wshrpc.CommandGetMetaData{ORef: *fullORef}, &wshrpc.RpcOpts{Timeout: 2000})
if err != nil {
	if errors.Is(err, context.DeadlineExceeded) {
		// retry once with a longer timeout
	}
	return fmt.Errorf("error getting block metadata: %w", err)
}

Prevention

When it happens

Trigger: GetMetaCommand returning an error for the resolved block ORef: invalid/unknown OID, RPC timeout (2000ms), or no running Wave app to serve the request.

Common situations: Typing a wrong block OID argument; the referenced block was deleted; network/route issues between wsh and the Wave app.

Related errors


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