DioxusLabs/dioxus · error · anyhow::Error

No input file, source, or stdin to translate from.

Error message

No input file, source, or stdin to translate from.

What it means

Input guard in determine_input (called from translate): neither `--raw` nor `--file` was provided, and stdin is attached to a terminal rather than a pipe, so there is no source text to translate. The input at fault is the empty combination of all three input channels (raw source, file path, piped stdin).

Source

Thrown at packages/cli/src/cli/translate.rs:125

fn determine_input(file: Option<String>, raw: Option<String>) -> Result<String> {
    use std::io::IsTerminal as _;

    // Make sure not both are specified
    if file.is_some() && raw.is_some() {
        bail!("Only one of --file or --raw should be specified.");
    }

    if let Some(raw) = raw {
        return Ok(raw);
    }

    if let Some(file) = file {
        return Ok(std::fs::read_to_string(file)?);
    }

    // If neither exist, we try to read from stdin
    if std::io::stdin().is_terminal() {
        bail!("No input file, source, or stdin to translate from.");
    }

    let mut buffer = String::new();
    std::io::stdin().read_to_string(&mut buffer).unwrap();

    Ok(buffer.trim().to_string())
}

View on GitHub (pinned to 24f6a829df)

Solutions

  1. Provide input to dx translate via --file, --raw, or stdin.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cli/src/cli/translate.rs:125 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/35f9f44b94af67ab. Report an issue: GitHub.