{"record":{"id":"6aa38ae821072709","repo":"DioxusLabs/dioxus","slug":"cargo-fmt-failed-with-status-out","errorCode":null,"errorMessage":"cargo fmt failed with status: {out:?}","messagePattern":"cargo fmt failed with status: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/cli/autoformat.rs","lineNumber":212,"sourceCode":"        bail!(\"{files_formatted} files needed formatting\");\n    }\n\n    Ok(())\n}\n\nfn indentation_for(\n    file_or_dir: impl AsRef<Path>,\n    split_line_attributes: bool,\n) -> Result<IndentOptions> {\n    let out = std::process::Command::new(\"cargo\")\n        .args([\"fmt\", \"--\", \"--print-config\", \"current\"])\n        .arg(file_or_dir.as_ref())\n        .stdout(std::process::Stdio::piped())\n        .stderr(std::process::Stdio::inherit())\n        .output()?;\n\n    if !out.status.success() {\n        bail!(\"cargo fmt failed with status: {out:?}\");\n    }\n\n    let config = String::from_utf8_lossy(&out.stdout);\n\n    let hard_tabs = config\n        .lines()\n        .find(|line| line.starts_with(\"hard_tabs \"))\n        .and_then(|line| line.split_once('='))\n        .map(|(_, value)| value.trim() == \"true\")\n        .context(\"Could not find hard_tabs option in rustfmt config\")?;\n    let tab_spaces = config\n        .lines()\n        .find(|line| line.starts_with(\"tab_spaces \"))\n        .and_then(|line| line.split_once('='))\n        .map(|(_, value)| value.trim().parse::<usize>())\n        .context(\"Could not find tab_spaces option in rustfmt config\")?\n        .context(\"Could not parse tab_spaces option in rustfmt config\")?;\n","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/cli/autoformat.rs#L194-L230","documentation":"Raised in indentation_for when the `cargo fmt -- --print-config current` subprocess used to discover rustfmt's configured indentation exits with a non-success status. This is an external tool failure: cargo/rustfmt could not produce the config for the given file or directory (broken toolchain, bad config, or cargo errors), so indentation options cannot be derived.","triggerScenarios":"Thrown at packages/cli/src/cli/autoformat.rs:212 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["cargo fmt failed. Fix the syntax errors rustfmt reported in the output."],"exampleFix":null,"handlingStrategy":"try-catch","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"}