{"record":{"id":"9a0114ef217048db","repo":"plandex-ai/plandex","slug":"error-starting-stream-ui-v","errorCode":null,"errorMessage":"error starting stream UI: %v","messagePattern":"error starting stream UI: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/plan_exec/build.go","lineNumber":76,"sourceCode":"\tterm.StopSpinner()\n\n\tif apiErr != nil {\n\t\tif apiErr.Msg == shared.NoBuildsErr {\n\t\t\tfmt.Println(\"🤷‍♂️ This plan has no pending changes to build\")\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn false, fmt.Errorf(\"error building plan: %v\", apiErr.Msg)\n\t}\n\n\tif !buildBg {\n\t\tch := make(chan error)\n\n\t\tgo func() {\n\t\t\terr := streamtui.StartStreamUI(\"\", true, !flags.AutoApply)\n\n\t\t\tif err != nil {\n\t\t\t\tch <- fmt.Errorf(\"error starting stream UI: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tch <- nil\n\t\t}()\n\n\t\t// Wait for the stream to finish\n\t\terr := <-ch\n\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\treturn true, nil\n}\n","sourceCodeStart":58,"sourceCodeEnd":93,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/plan_exec/build.go#L58-L93","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running the CLI in CI pipelines or non-interactive shells without a TTY; terminals with minimal TERM settings; SSH sessions without pty allocation.","solutions":["Run the command in an interactive terminal with a valid TTY","Set TERM to a supported value (e.g. xterm-256color)","Use the background/async build flag instead of foreground streaming","Upgrade the CLI if the TUI crashes on your terminal emulator"],"exampleFix":"// before (CI, no TTY)\nplandex build\n// after\nplandex build --bg   # or run inside a pty: script -qec \"plandex build\" /dev/null","handlingStrategy":"fallback","validationCode":"// ensure stdout is a terminal before foreground streaming\nif !term.IsTerminal(int(os.Stdout.Fd())) {\n    // use background build instead\n    useBgBuild = true\n}","typeGuard":"func hasTTY() bool {\n    fi, _ := os.Stdout.Stat()\n    return fi != nil && (fi.Mode()&os.ModeCharDevice) != 0\n}","tryCatchPattern":"ok, err := Build(params)\nif err != nil && strings.Contains(err.Error(), \"error starting stream UI\") {\n    // fall back to background build or non-interactive output\n    ok, err = BuildBg(params)\n}","preventionTips":["Run interactive builds only in TTY-attached shells","Set a proper TERM value in remote/SSH environments","Use --bg in CI and scripts","Allocate a pty when running over SSH (ssh -t)"],"tags":["terminal","tui","stream"],"backgroundTag":"tty-required","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"}