{"record":{"id":"5139437d14e41877","repo":"DioxusLabs/dioxus","slug":"only-one-of-file-or-raw-should-be-specified","errorCode":null,"errorMessage":"Only one of --file or --raw should be specified.","messagePattern":"Only one of --file or --raw should be specified\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/cli/translate.rs","lineNumber":112,"sourceCode":"    out.push_str(\"\\n}\");\n}\n\nfn indent_and_write(raw: &str, idx: usize, out: &mut String) {\n    for line in raw.lines() {\n        for _ in 0..idx {\n            out.push_str(\"    \");\n        }\n        out.push_str(line);\n        out.push('\\n');\n    }\n}\n\nfn determine_input(file: Option<String>, raw: Option<String>) -> Result<String> {\n    use std::io::IsTerminal as _;\n\n    // Make sure not both are specified\n    if file.is_some() && raw.is_some() {\n        bail!(\"Only one of --file or --raw should be specified.\");\n    }\n\n    if let Some(raw) = raw {\n        return Ok(raw);\n    }\n\n    if let Some(file) = file {\n        return Ok(std::fs::read_to_string(file)?);\n    }\n\n    // If neither exist, we try to read from stdin\n    if std::io::stdin().is_terminal() {\n        bail!(\"No input file, source, or stdin to translate from.\");\n    }\n\n    let mut buffer = String::new();\n    std::io::stdin().read_to_string(&mut buffer).unwrap();\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/cli/translate.rs#L94-L130","documentation":"Argument guard in determine_input (called from translate): both the `--file` and `--raw` CLI options were supplied, but the translator accepts exactly one input source. The inputs at fault are the mutually exclusive file/raw arguments, and the guard fires before any input is read.","triggerScenarios":"Thrown at packages/cli/src/cli/translate.rs:112 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass only one of --file or --raw to dx translate."],"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-14T00:17:10.932Z"}