wavetermdev/waveterm · error

running view command: %w

Error message

running view command: %w

What it means

editorRun calls the CreateBlock RPC (CreateBlockCommand) to open the file in an editor block. Any RPC failure — connection drop, timeout (2000 ms here), server-side block-creation error — is wrapped as "running view command".

Source

Thrown at cmd/wsh/cmd/wshcmd-editor.go:80

	wshCmd := wshrpc.CommandCreateBlockData{
		TabId: tabId,
		BlockDef: &waveobj.BlockDef{
			Meta: map[string]any{
				waveobj.MetaKey_View: "preview",
				waveobj.MetaKey_File: absFile,
				waveobj.MetaKey_Edit: true,
			},
		},
		Magnified: editMagnified,
		Focused:   true,
	}
	if RpcContext.Conn != "" {
		wshCmd.BlockDef.Meta[waveobj.MetaKey_Connection] = RpcContext.Conn
	}
	blockRef, err := wshclient.CreateBlockCommand(RpcClient, wshCmd, &wshrpc.RpcOpts{Timeout: 2000})
	if err != nil {
		return fmt.Errorf("running view command: %w", err)
	}
	doneCh := make(chan bool)
	RpcClient.EventListener.On(wps.Event_BlockClose, func(event *wps.WaveEvent) {
		if event.HasScope(blockRef.String()) {
			close(doneCh)
		}
	})
	wshclient.EventSubCommand(RpcClient, wps.SubscriptionRequest{Event: wps.Event_BlockClose, Scopes: []string{blockRef.String()}}, nil)
	<-doneCh
	return nil
}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Confirm the Wave app is running and the tab referenced by WAVETERM_TABID still exists.
  2. Check network/SSH connectivity to the remote host if --conn was used; re-run after reconnecting.
  3. Retry the command — the 2s timeout can be too short on slow links.
  4. Ensure wsh client and server versions match (run `wsh --version` on both ends and update).
Defensive patterns

Strategy: retry

Validate before calling

// preflight: ensure the RPC connection is alive
if RpcContext.Conn != "" {
    if err := wshclient.ConnectionCheckCommand(RpcClient, RpcContext.Conn, &wshrpc.RpcOpts{Timeout: 2000}); err != nil {
        return fmt.Errorf("connection unavailable before creating block")
    }
}

Try / catch

blockRef, err := wshclient.CreateBlockCommand(RpcClient, wshCmd, &wshrpc.RpcOpts{Timeout: 2000})
if err != nil {
    // retry once after short backoff; then surface wrapped error
}

Prevention

When it happens

Trigger: CreateBlockCommand fails: the wsh RPC connection is down or slow (>2s timeout), the target tab no longer exists, the connection (RpcContext.Conn) is unreachable, or the server rejects the BlockDef.

Common situations: Remote host connection is flaky or the SSH connection was dropped; tab was closed between reading WAVETERM_TABID and the RPC; wsh server version mismatch causes the CreateBlock command to be unknown or rejected.

Related errors


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