wavetermdev/waveterm · error

no WAVETERM_TABID env var set

Error message

no WAVETERM_TABID env var set

What it means

wsh wavepath runs inside the Wave terminal environment and derives the target tab from the WAVETERM_TABID env var, which the terminal injects into wsh subprocesses. If it is empty, wavepathRun cannot resolve which tab's path to request and fails before issuing the RPC.

Source

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

	}

	pathType := args[0]
	if pathType != "config" && pathType != "data" && pathType != "log" {
		OutputHelpMessage(cmd)
		return fmt.Errorf("invalid path type %q. must be one of: config, data, log", pathType)
	}

	tail, _ := cmd.Flags().GetBool("tail")
	if tail && pathType != "log" {
		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

View on GitHub (pinned to a4447c1563)

Solutions

  1. Run the command from a shell spawned inside Wave Terminal so WAVETERM_TABID is set.
  2. Verify with `echo $WAVETERM_TABID`; if empty, relaunch the shell from within Wave.
  3. Explicitly export WAVETERM_TABID=<tabid> for headless/scripted use.

Example fix

// before (plain shell)
wsh wavepath log
// after
export WAVETERM_TABID=<tab-id>
wsh wavepath log
Defensive patterns

Strategy: validation

Validate before calling

if [ -z "$WAVETERM_TABID" ]; then echo "run inside Wave Terminal or export WAVETERM_TABID" >&2; exit 1; fi

Try / catch

if err := runWavepath(); err != nil { if strings.Contains(err.Error(), "WAVETERM_TABID") { fallbackToNonTabPath() } else { return err } }

Prevention

When it happens

Trigger: Running `wsh wavepath ...` outside a Wave terminal (plain shell, CI, SSH session, editor terminal launched before Wave env was loaded) or with WAVETERM_TABID explicitly unset/emptied.

Common situations: Running wsh from bash/zsh started independently of Wave, Docker containers, cron jobs, or after `env -i` / `unset WAVETERM_TABID` in scripts.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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