wavetermdev/waveterm · error

getting path: %w

Error message

getting path: %w

What it means

This wraps any error returned by the wshclient.PathCommand RPC, which asks the Wave server for the requested path. The failure happened server-side or in transport, not in local argument validation; the original error is preserved via %w.

Source

Thrown at cmd/wsh/cmd/wshcmd-wavepath.go:71

		return fmt.Errorf("--tail can only be used with the log path type")
	}

	open, _ := cmd.Flags().GetBool("open")
	openExternal, _ := cmd.Flags().GetBool("open-external")

	tabId := getTabIdFromEnv()
	if tabId == "" {
		return fmt.Errorf("no WAVETERM_TABID env var set")
	}

	path, err := wshclient.PathCommand(RpcClient, wshrpc.PathCommandData{
		PathType:     pathType,
		Open:         open,
		OpenExternal: openExternal,
		TabId:        tabId,
	}, nil)
	if err != nil {
		return fmt.Errorf("getting path: %w", err)
	}

	if tail && pathType == "log" {
		err = tailLogFile(path)
		if err != nil {
			return fmt.Errorf("tailing log file: %w", err)
		}
		return nil
	}

	WriteStdout("%s\n", path)
	return nil
}

func tailLogFile(path string) error {
	file, err := os.Open(path)
	if err != nil {
		return fmt.Errorf("opening log file: %w", err)

View on GitHub (pinned to a4447c1563)

Solutions

  1. Inspect the wrapped cause in the error output for the root reason (connection vs. path).
  2. Verify the terminal connection: run another wsh RPC command like `wsh ls` to test connectivity.
  3. Check that the WAVETERM_TABID refers to an open tab.
  4. Check OS permissions on the Wave config/data/log directories.

Example fix

// before
tabId := getTabIdFromEnv()
// after
if tabId == "" { return errors.New("WAVETERM_TABID not set") } // catch stale/empty tab ids before RPC
Defensive patterns

Strategy: try-catch

Validate before calling

wsh ls >/dev/null 2>&1 || { echo "wsh RPC unavailable" >&2; exit 1; }

Try / catch

path, err := wshclient.PathCommand(RpcClient, data, nil)
if err != nil {
    var connErr *net.OpError
    if errors.As(err, &connErr) { /* reconnect terminal */ }
    return fmt.Errorf("getting path: %w", err)
}

Prevention

When it happens

Trigger: The RPC to the Wave server fails: no connection to the terminal, server rejected the path type or tab id, or the underlying path lookup fails (e.g. wave data dir missing, permission denied).

Common situations: wsh run against an unreachable/stale terminal connection, an invalid TabId pointing to a closed tab, or OS-level permission problems on the Wave config/data/log directories.

Related errors


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