plandex-ai/plandex · error

error starting stream UI: %v

Error message

error starting stream UI: %v

What it means

When a build is run in the foreground, Build starts a goroutine running streamtui.StartStreamUI and wraps its error. This error means the terminal streaming UI failed to start (TTY setup, terminal capability, or internal UI error), not that the build itself failed.

Source

Thrown at app/cli/plan_exec/build.go:76

	term.StopSpinner()

	if apiErr != nil {
		if apiErr.Msg == shared.NoBuildsErr {
			fmt.Println("🤷‍♂️ This plan has no pending changes to build")
			return false, nil
		}

		return false, fmt.Errorf("error building plan: %v", apiErr.Msg)
	}

	if !buildBg {
		ch := make(chan error)

		go func() {
			err := streamtui.StartStreamUI("", true, !flags.AutoApply)

			if err != nil {
				ch <- fmt.Errorf("error starting stream UI: %v", err)
				return
			}

			ch <- nil
		}()

		// Wait for the stream to finish
		err := <-ch

		if err != nil {
			return false, err
		}
	}

	return true, nil
}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Run the command in an interactive terminal with a valid TTY
  2. Set TERM to a supported value (e.g. xterm-256color)
  3. Use the background/async build flag instead of foreground streaming
  4. Upgrade the CLI if the TUI crashes on your terminal emulator

Example fix

// before (CI, no TTY)
plandex build
// after
plandex build --bg   # or run inside a pty: script -qec "plandex build" /dev/null
Defensive patterns

Strategy: fallback

Validate before calling

// ensure stdout is a terminal before foreground streaming
if !term.IsTerminal(int(os.Stdout.Fd())) {
    // use background build instead
    useBgBuild = true
}

Type guard

func hasTTY() bool {
    fi, _ := os.Stdout.Stat()
    return fi != nil && (fi.Mode()&os.ModeCharDevice) != 0
}

Try / catch

ok, err := Build(params)
if err != nil && strings.Contains(err.Error(), "error starting stream UI") {
    // fall back to background build or non-interactive output
    ok, err = BuildBg(params)
}

Prevention

When it happens

Trigger: streamtui.StartStreamUI("", true, !flags.AutoApply) returns an error: no TTY attached (piped/CI output), unsupported terminal, or the stream connection to the server failed during UI startup.

Common situations: Running the CLI in CI pipelines or non-interactive shells without a TTY; terminals with minimal TERM settings; SSH sessions without pty allocation.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/9a0114ef217048db. Report an issue: GitHub.