plandex-ai/plandex · error

error running stream UI: %v

Error message

error running stream UI: %v

What it means

StartStreamUI wraps any error surfaced by the Bubbletea program (the stream TUI) with this message. The TUI model stores failures (like file read errors or API errors) in its `err` field, and once the program exits, StartStreamUI converts that stored error into the returned error. It is a generic wrapper: the root cause is whatever the model recorded in m.err.

Source

Thrown at app/cli/stream_tui/run.go:52

	log.Println("Starting stream UI")

	initial := initialModel(prestartReply, prompt, buildOnly, canSendToBg)

	mu.Lock()
	ui = tea.NewProgram(initial, tea.WithAltScreen())
	mu.Unlock()

	log.Println("Running bubbletea program")
	wg.Add(1)
	m, err := ui.Run()
	log.Println("Bubbletea program finished")
	wg.Done()

	log.Println("Stream UI finished")

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

	var mod *streamUIModel
	c, ok := m.(*streamUIModel)
	if ok {
		mod = c
	} else {
		c := m.(streamUIModel)
		mod = &c
	}

	fmt.Println()

	if !mod.buildOnly {
		fmt.Println(mod.mainDisplay)
	}

	if len(mod.finishedByPath) > 0 || len(mod.tokensByPath) > 0 {

View on GitHub (pinned to e2d772072e)

Solutions

  1. Read the wrapped cause after 'error running stream UI:' in the message — it names the real failure
  2. Fix the underlying cause (file path, network, API auth) that the TUI model recorded
  3. Re-run the command; transient stream/network failures usually resolve on retry
  4. If reproducible, check logs (log.Println output) for the TUI-internal error printed before exit

Example fix

// before
err := app.StartStreamUI(...)
if err != nil { log.Fatal(err) }
// after
err := app.StartStreamUI(...)
if err != nil {
    var ctxErr *fmt.WrapError // inspect wrapped cause
    log.Fatalf("stream UI failed: %v", err) // surface full wrapped chain, not just the wrapper
}
Defensive patterns

Strategy: try-catch

Try / catch

if err := StartStreamUI(...); err != nil {
    log.Printf("stream UI failed: %v", err) // logged chain includes the wrapped TUI cause
    return err
}

Prevention

When it happens

Trigger: The Bubbletea program for the stream UI exits while the model's `err` field is non-nil — e.g. a tea.Cmd inside the TUI failed (file read failure, RespondMissingFile API error, connection dropped) and set m.err before tea.Quit.

Common situations: Running `plandex` stream TUI when a referenced missing-file response fails, the plan stream connection breaks mid-session, or a background tea.Msg handler errors out; user sees 'error running stream UI: ...' after the TUI closes.

Related errors


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