{"record":{"id":"71ce44201494de58","repo":"Hmbown/CodeWhale","slug":"codewhale-tui-requires-an-interactive-terminal-st","errorCode":null,"errorMessage":"Codewhale TUI requires an interactive terminal (stdin and stdout must be a TTY).\nOpen a real terminal (Terminal.app, iTerm, Windows Terminal, …) and run `codew` or `codewhale` there — not from a pipe, cron job, or non-TTY launcher.\nFor headless prompts use `codewhale exec \"…\"` instead.","messagePattern":"Codewhale TUI requires an interactive terminal \\(stdin and stdout must be a TTY\\)\\.\nOpen a real terminal \\(Terminal\\.app, iTerm, Windows Terminal, …\\) and run `codew` or `codewhale` there — not from a pipe, cron job, or non-TTY launcher\\.\nFor headless prompts use `codewhale exec \"…\"` instead\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/ui/terminal.rs","lineNumber":57,"sourceCode":"pub(crate) fn collect_pending_terminal_events(\n    input: &TerminalInputPump,\n    pending: &mut VecDeque<Event>,\n) -> io::Result<()> {\n    while let Some(event) = input.try_recv()? {\n        pending.push_back(event);\n    }\n    Ok(())\n}\n\n/// Refuse to enter raw mode unless both interactive streams are TTYs.\n///\n/// Keeping this check independent from `std::io` makes the launch contract\n/// testable without trying to manipulate the test runner's own terminal.\npub(crate) fn require_interactive_terminal(stdin_is_tty: bool, stdout_is_tty: bool) -> Result<()> {\n    if stdin_is_tty && stdout_is_tty {\n        return Ok(());\n    }\n    Err(anyhow::anyhow!(\n        \"Codewhale TUI requires an interactive terminal (stdin and stdout must be a TTY).\\n\\\n         Open a real terminal (Terminal.app, iTerm, Windows Terminal, …) and run `codew` \\\n         or `codewhale` there — not from a pipe, cron job, or non-TTY launcher.\\n\\\n         For headless prompts use `codewhale exec \\\"…\\\"` instead.\"\n    ))\n}\n\n/// One side of the raw-mode probe abandonment handshake between the startup\n/// probe timeout and the blocking `enable_raw_mode` task finishing late.\n///\n/// Each side publishes its own flag (`publish`), then checks whether the\n/// other side's flag (`check`) is already up; a `true` return means this\n/// side must disable raw mode again. `SeqCst` ordering guarantees that when\n/// both sides run, at least one observes the other's flag, so a raw-mode\n/// enable landing after the probe timeout is always undone. Both sides\n/// observing each other is fine — a duplicate `disable_raw_mode` is a no-op.\npub(crate) fn raw_mode_probe_handshake(publish: &AtomicBool, check: &AtomicBool) -> bool {\n    publish.store(true, Ordering::SeqCst);","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tui/ui/terminal.rs#L39-L75","documentation":"Error \"Codewhale TUI requires an interactive terminal (stdin and stdout must be a TTY).\nOpen a real terminal (Terminal.app, iTerm, Windows Terminal, …) and run `codew` or `codewhale` there — not from a pipe, cron job, or non-TTY launcher.\nFor headless prompts use `codewhale exec \"…\"` instead.\" thrown in Hmbown/CodeWhale.","triggerScenarios":"Thrown at crates/tui/src/tui/ui/terminal.rs:57 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run `codew` or `codewhale` directly inside an interactive terminal emulator such as Terminal.app, iTerm2, or Windows Terminal.","If invoking from a script or scheduler, drop the TUI and use `codewhale exec \"…\"` for headless, non-TTY prompts.","Check that stdin and stdout are not redirected through pipes or files; relaunch with both attached to a real TTY."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}