{"record":{"id":"c83494940d6bab89","repo":"alibaba/open-code-review","slug":"tui-error-w","errorCode":null,"errorMessage":"TUI error: %w","messagePattern":"TUI error: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/provider_cmd.go","lineNumber":34,"sourceCode":"\t\"github.com/alibaba/open-code-review/internal/llm\"\n)\n\nfunc runConfigProvider() error {\n\tconfigPath, err := defaultConfigPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcfg, err := loadOrCreateConfig(configPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"load config: %w\", err)\n\t}\n\n\tm := newProviderTUI(cfg, configPath)\n\tp := tea.NewProgram(m)\n\tfinalModel, err := p.Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"TUI error: %w\", err)\n\t}\n\n\tfinal := finalModel.(providerTUIModel)\n\n\tif !final.confirmed {\n\t\t// TUI persists changes during the session; Esc only abandons the final\n\t\t// provider/API-key confirmation step.\n\t\tprintWizardCancelled(final.savedInSession, \"Configuration changes\")\n\t\treturn nil\n\t}\n\n\tresult := final.result()\n\n\tif result.isManual {\n\t\treturn applyManualConfig(configPath, cfg, result)\n\t}\n\n\tif result.isCustom {","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/provider_cmd.go#L16-L52","documentation":"This error wraps a failure from the Bubble Tea program run (`p.Run()`) inside `ocr config provider`. The interactive TUI could not start or crashed mid-session — commonly because the terminal cannot enter the required mode (not a TTY) or the terminal is too small.","triggerScenarios":"Running `ocr config provider` in an environment without a usable TTY (CI jobs, piped/redirected stdout), or when tea.NewProgram(...).Run() fails due to terminal initialization errors.","commonSituations":"Attempting the interactive TUI inside Docker/CI where stdin is not a terminal; running over a stripped-down SSH connection; piping the command's output to a file.","solutions":["Run the command in an interactive terminal with a working stdin/stdout TTY.","In CI, skip the TUI: edit the config file directly or use non-interactive setup.","If using Docker, allocate a TTY: `docker run -it ...`.","Read the wrapped cause after 'TUI error:' — it names the terminal-mode failure."],"exampleFix":"# before (fails in CI)\nocr config provider | tee out.log\n# after\n# run interactively locally, or edit config non-interactively:\n$EDITOR ~/.ocr/config.toml","handlingStrategy":"fallback","validationCode":"// ensure a TTY before launching the TUI\nif fi, _ := os.Stdin.Stat(); fi.Mode()&os.ModeCharDevice == 0 {\n    return errors.New(\"interactive TUI requires a terminal; edit config file directly instead\")\n}","typeGuard":null,"tryCatchPattern":"finalModel, err := p.Run()\nif err != nil {\n    return fmt.Errorf(\"TUI error: %w\", err)\n}","preventionTips":["Only run `ocr config provider` in an interactive terminal.","In CI/Docker use `docker run -it` or edit the config file non-interactively.","Keep terminal windows large enough for the TUI."],"tags":["tui","terminal","cli","tty"],"backgroundTag":"tui-not-a-tty","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}