{"record":{"id":"3b6c80b021ebce42","repo":"plandex-ai/plandex","slug":"error-running-stream-ui-v","errorCode":null,"errorMessage":"error running stream UI: %v","messagePattern":"error running stream UI: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/stream_tui/run.go","lineNumber":52,"sourceCode":"\n\tlog.Println(\"Starting stream UI\")\n\n\tinitial := initialModel(prestartReply, prompt, buildOnly, canSendToBg)\n\n\tmu.Lock()\n\tui = tea.NewProgram(initial, tea.WithAltScreen())\n\tmu.Unlock()\n\n\tlog.Println(\"Running bubbletea program\")\n\twg.Add(1)\n\tm, err := ui.Run()\n\tlog.Println(\"Bubbletea program finished\")\n\twg.Done()\n\n\tlog.Println(\"Stream UI finished\")\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error running stream UI: %v\", err)\n\t}\n\n\tvar mod *streamUIModel\n\tc, ok := m.(*streamUIModel)\n\tif ok {\n\t\tmod = c\n\t} else {\n\t\tc := m.(streamUIModel)\n\t\tmod = &c\n\t}\n\n\tfmt.Println()\n\n\tif !mod.buildOnly {\n\t\tfmt.Println(mod.mainDisplay)\n\t}\n\n\tif len(mod.finishedByPath) > 0 || len(mod.tokensByPath) > 0 {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/stream_tui/run.go#L34-L70","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the wrapped cause after 'error running stream UI:' in the message — it names the real failure","Fix the underlying cause (file path, network, API auth) that the TUI model recorded","Re-run the command; transient stream/network failures usually resolve on retry","If reproducible, check logs (log.Println output) for the TUI-internal error printed before exit"],"exampleFix":"// before\nerr := app.StartStreamUI(...)\nif err != nil { log.Fatal(err) }\n// after\nerr := app.StartStreamUI(...)\nif err != nil {\n    var ctxErr *fmt.WrapError // inspect wrapped cause\n    log.Fatalf(\"stream UI failed: %v\", err) // surface full wrapped chain, not just the wrapper\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := StartStreamUI(...); err != nil {\n    log.Printf(\"stream UI failed: %v\", err) // logged chain includes the wrapped TUI cause\n    return err\n}","preventionTips":["Keep the stream session network-stable (the TUI records stream errors into m.err)","Ensure any missing-file path you provide exists and is readable before responding","Check logs printed by the TUI for the underlying cause before the wrapper appears"],"tags":["go","tui","bubbletea","cli"],"backgroundTag":"tui-runtime-error","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}