DioxusLabs/dioxus · error · anyhow::Error

{files_formatted} files needed formatting

Error message

{files_formatted} files needed formatting

What it means

Check-mode guard in autoformat_project: files were formatted across the project (each file's formatted-line counts are summed), but the command was invoked in check mode, so any non-zero count is treated as a failure rather than silently rewriting files. The input at fault is the set of unformatted source files; the count reports how many needed formatting.

Source

Thrown at packages/cli/src/cli/autoformat.rs:194

    let counts = files_to_format
        .into_par_iter()
        .map(|path| {
            let res = format_file(&path, indent.clone(), format_rust_code);
            match res {
                Ok(cnt) => Some(cnt),
                Err(err) => {
                    tracing::error!("error formatting file : {}\n{:#?}", path.display(), err);
                    None
                }
            }
        })
        .collect::<Vec<_>>();

    let files_formatted: usize = counts.into_iter().flatten().sum();

    if files_formatted > 0 && check {
        bail!("{files_formatted} files needed formatting");
    }

    Ok(())
}

fn indentation_for(
    file_or_dir: impl AsRef<Path>,
    split_line_attributes: bool,
) -> Result<IndentOptions> {
    let out = std::process::Command::new("cargo")
        .args(["fmt", "--", "--print-config", "current"])
        .arg(file_or_dir.as_ref())
        .stdout(std::process::Stdio::piped())
        .stderr(std::process::Stdio::inherit())
        .output()?;

    if !out.status.success() {
        bail!("cargo fmt failed with status: {out:?}");

View on GitHub (pinned to 24f6a829df)

Solutions

  1. Some files are not formatted. Run dx fmt (or cargo fmt) to format them.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cli/src/cli/autoformat.rs:194 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/0ca3be92e5c8d8fe. Report an issue: GitHub.