DioxusLabs/dioxus · error
Cannot enable raw mode on a non-terminal output
Error message
Cannot enable raw mode on a non-terminal output
What it means
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.
Source
Thrown at packages/cli/src/serve/output.rs:157
/// Enable raw mode, but don't let it block forever.
///
/// This lets us check if writing to tty is going to block forever and then recover, allowing
/// interopability with programs like `bg`.
fn enable_raw_mode() -> Result<()> {
#[cfg(unix)]
{
use tokio::signal::unix::{SignalKind, signal};
// Ignore SIGTSTP, SIGTTIN, and SIGTTOU
_ = signal(SignalKind::from_raw(20))?; // SIGTSTP
_ = signal(SignalKind::from_raw(21))?; // SIGTTIN
_ = signal(SignalKind::from_raw(22))?; // SIGTTOU
}
use std::io::IsTerminal;
if !stdout().is_terminal() {
bail!("Cannot enable raw mode on a non-terminal output");
}
enable_raw_mode()?;
stdout()
.execute(Hide)?
.execute(EnableFocusChange)?
.execute(EnableBracketedPaste)?;
Ok(())
}
pub(crate) fn remote_shutdown(interactive: bool) -> Result<()> {
if interactive && crossterm::terminal::is_raw_mode_enabled().unwrap_or(true) {
stdout()
.execute(Show)?
.execute(DisableFocusChange)?
.execute(DisableBracketedPaste)?;
disable_raw_mode()?;View on GitHub (pinned to 24f6a829df)
Solutions
- Raw mode needs a terminal. Run dx serve in a real terminal, or use a non-TUI output mode.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/cli/src/serve/output.rs:157 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23).
Data as JSON: /api/errors/883bb4c1a1b8afca.
Report an issue: GitHub.