wavetermdev/waveterm · error

failed to list workspaces: %v

Error message

failed to list workspaces: %v

What it means

Error from `wsh blocks list` when the WorkspaceListCommand RPC fails. The command cannot enumerate the terminal's workspaces, which is the first step of listing blocks, so it aborts with this wrapper around the underlying RPC error. It indicates a transport or server-side problem rather than an empty result.

Source

Thrown at cmd/wsh/cmd/wshcmd-blocks.go:111

	blocksCmd.AddCommand(blocksListCmd)
	rootCmd.AddCommand(blocksCmd)
}

// blocksListRun implements the 'blocks list' command
// It retrieves and displays blocks with optional filtering by workspace, window, tab, or view type
func blocksListRun(cmd *cobra.Command, args []string) error {
	if v := strings.TrimSpace(blocksView); v != "" {
		if !isKnownViewFilter(v) {
			return fmt.Errorf("unknown --view %q; try one of: term, web, preview, edit, sysinfo, waveai", v)
		}
	}

	var allBlocks []BlockDetails

	workspaces, err := wshclient.WorkspaceListCommand(RpcClient, &wshrpc.RpcOpts{Timeout: int64(blocksTimeout)})
	if err != nil {
		return fmt.Errorf("failed to list workspaces: %v", err)
	}

	if len(workspaces) == 0 {
		return fmt.Errorf("no workspaces found")
	}

	var workspaceIdsToQuery []string

	// Determine which workspaces to query
	if blocksWorkspaceId != "" && blocksWindowId != "" {
		return fmt.Errorf("--workspace and --window are mutually exclusive; specify only one")
	}
	if blocksWorkspaceId != "" {
		workspaceIdsToQuery = []string{blocksWorkspaceId}
	} else if blocksWindowId != "" {
		// Find workspace ID for this window
		windowFound := false
		for _, ws := range workspaces {

View on GitHub (pinned to a4447c1563)

Solutions

  1. Check `wsh conn status` / ensure Wave Terminal is running and reachable
  2. Increase --timeout so the WorkspaceList RPC can complete
  3. Reconnect the SSH/WSL connection and retry
  4. Verify the remote Wave/wsh version supports WorkspaceListCommand

Example fix

// before
workspaces, err := wshclient.WorkspaceListCommand(RpcClient, &wshrpc.RpcOpts{Timeout: int64(blocksTimeout)})
// after
workspaces, err := wshclient.WorkspaceListCommand(RpcClient, &wshrpc.RpcOpts{Timeout: int64(blocksTimeout), NoHandleErr: true})
if err != nil {
    return fmt.Errorf("failed to list workspaces (is Wave running and connection alive?): %w", err)
}
Defensive patterns

Strategy: retry

Validate before calling

// confirm Wave is reachable before the RPC
if _, err := wshclient.WorkspaceListCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 5000}); err != nil {
    return fmt.Errorf("Wave not reachable, start the app or reconnect: %w", err)
}

Try / catch

var workspaces []wshrpc.WorkspaceInfo
var err error
for i := 0; i < 3 && err != nil; i++ {
    workspaces, err = wshclient.WorkspaceListCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 10000})
    time.Sleep(time.Second)
}

Prevention

When it happens

Trigger: Calling WorkspaceListCommand over a connRoute where the Wave server is unreachable, the RPC times out (blocksTimeout too small), the remote does not implement the workspace list RPC, or the wsh client is not attached to a running Wave instance.

Common situations: Running wsh remotely without `wsh board`/connected app context; Wave Terminal not running; timeout too aggressive in slow network conditions; version mismatch missing the RPC.

Related errors


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