atuinsh/atuin · error · std::io::Error

Interactive mode requires a terminal

Error message

Interactive mode requires a terminal

What it means

When building the interactive search UI's terminal writer, platforms that are neither unix nor windows have no supported console implementation, so `new` returns an io::Error with kind Unsupported and message "Interactive mode requires a terminal". It means the interactive full-screen search cannot run on this platform (or without a TTY abstraction).

Solutions

  1. Use non-interactive search instead (`atuin search --search-mode <mode>` without interactive TUI, or pipe output).
  2. Run on a supported platform (unix or windows) where the terminal writer is implemented.
  3. If you maintain the port, implement a TerminalWriter variant for the platform behind the same cfg gate.
  4. Force interactive off via configuration/scripting so the Unsupported path is never taken.

Example fix

// before
atuin search -i  // interactive, unsupported on this platform

// after
atuin search --limit 10  // non-interactive listing works everywhere
Defensive patterns

Strategy: fallback

Validate before calling

// gate interactive mode on supported platforms at runtime
#[cfg(any(unix, windows))]
let interactive_ok = true;
#[cfg(not(any(unix, windows)))]
let interactive_ok = false;

Try / catch

match setup_terminal() {
    Ok(w) => run_interactive(w),
    Err(e) if e.kind() == std::io::ErrorKind::Unsupported => {
        eprintln!("interactive mode unavailable here; falling back to list output");
        run_non_interactive()?;
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Running atuin's interactive search (`atuin search` interactive mode / Ctrl-R) on a target compiled for a platform other than unix or windows (cfg not(any(unix, windows))), where the TerminalWriter setup is unimplemented.

Common situations: Building/running atuin on wasm,Redox, or another exotic target; embedding atuin on an unsupported platform and invoking interactive mode instead of non-interactive search.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of atuinsh/atuin@900007c480 (2026-09-19). Data as JSON: /api/errors/6499ff40fa42df31. Report an issue: GitHub.

Appendix: source

Thrown at crates/atuin/src/command/client/search/interactive.rs:1528

        // On Windows, use CONOUT$ which is the equivalent of /dev/tty, but this
        // requires setting the current console output code page to UTF-8 for the
        // TUI to render properly. We'll set it back to its previous value upon exit.
        #[cfg(windows)]
        {
            let file = std::fs::File::options().read(true).write(true).open("CONOUT$")?;

            let initial_console_output_cp = unsafe { GetConsoleOutputCP() };
            if initial_console_output_cp != Self::CP_UTF8 {
                unsafe {
                    SetConsoleOutputCP(Self::CP_UTF8);
                }
            }

            Ok(TerminalWriter::ConOut(std::io::LineWriter::new(file), initial_console_output_cp))
        }

        #[cfg(not(any(unix, windows)))]
        Err(std::io::Error::new(
            std::io::ErrorKind::Unsupported,
            "Interactive mode requires a terminal",
        ))
    }
}

impl Write for TerminalWriter {
    fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
        match self {
            TerminalWriter::Stdout(stdout) => stdout.write(buf),
            #[cfg(unix)]
            TerminalWriter::Tty(file) => file.write(buf),
            #[cfg(windows)]
            TerminalWriter::ConOut(writer, _) => writer.write(buf),
        }
    }

    fn flush(&mut self) -> std::io::Result<()> {

View on GitHub (pinned to 900007c480)