{"record":{"id":"883bb4c1a1b8afca","repo":"DioxusLabs/dioxus","slug":"cannot-enable-raw-mode-on-a-non-terminal-output","errorCode":null,"errorMessage":"Cannot enable raw mode on a non-terminal output","messagePattern":"Cannot enable raw mode on a non-terminal output","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/serve/output.rs","lineNumber":157,"sourceCode":"    /// Enable raw mode, but don't let it block forever.\n    ///\n    /// This lets us check if writing to tty is going to block forever and then recover, allowing\n    /// interopability with programs like `bg`.\n    fn enable_raw_mode() -> Result<()> {\n        #[cfg(unix)]\n        {\n            use tokio::signal::unix::{SignalKind, signal};\n\n            // Ignore SIGTSTP, SIGTTIN, and SIGTTOU\n            _ = signal(SignalKind::from_raw(20))?; // SIGTSTP\n            _ = signal(SignalKind::from_raw(21))?; // SIGTTIN\n            _ = signal(SignalKind::from_raw(22))?; // SIGTTOU\n        }\n\n        use std::io::IsTerminal;\n\n        if !stdout().is_terminal() {\n            bail!(\"Cannot enable raw mode on a non-terminal output\");\n        }\n\n        enable_raw_mode()?;\n        stdout()\n            .execute(Hide)?\n            .execute(EnableFocusChange)?\n            .execute(EnableBracketedPaste)?;\n\n        Ok(())\n    }\n\n    pub(crate) fn remote_shutdown(interactive: bool) -> Result<()> {\n        if interactive && crossterm::terminal::is_raw_mode_enabled().unwrap_or(true) {\n            stdout()\n                .execute(Show)?\n                .execute(DisableFocusChange)?\n                .execute(DisableBracketedPaste)?;\n            disable_raw_mode()?;","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/serve/output.rs#L139-L175","documentation":"Environment guard in the TUI output's enable_raw_mode: after installing Unix signal handlers (SIGTSTP/SIGTTIN/SIGTTOU) so terminal raw mode plays nicely with job control, the code checks whether stdout is actually a terminal and refuses to enable raw mode when it is not (e.g. output piped to a file or a non-tty program like `bg`). The input at fault is the non-terminal stdout the output layer was given.","triggerScenarios":"Thrown at packages/cli/src/serve/output.rs:157 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Raw mode needs a terminal. Run dx serve in a real terminal, or use a non-TUI output mode."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}