{"record":{"id":"0ca3be92e5c8d8fe","repo":"DioxusLabs/dioxus","slug":"files-formatted-files-needed-formatting","errorCode":null,"errorMessage":"{files_formatted} files needed formatting","messagePattern":"(.+?) files needed formatting","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/cli/autoformat.rs","lineNumber":194,"sourceCode":"\n    let counts = files_to_format\n        .into_par_iter()\n        .map(|path| {\n            let res = format_file(&path, indent.clone(), format_rust_code);\n            match res {\n                Ok(cnt) => Some(cnt),\n                Err(err) => {\n                    tracing::error!(\"error formatting file : {}\\n{:#?}\", path.display(), err);\n                    None\n                }\n            }\n        })\n        .collect::<Vec<_>>();\n\n    let files_formatted: usize = counts.into_iter().flatten().sum();\n\n    if files_formatted > 0 && check {\n        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:?}\");","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/cli/autoformat.rs#L176-L212","documentation":"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.","triggerScenarios":"Thrown at packages/cli/src/cli/autoformat.rs:194 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Some files are not formatted. Run dx fmt (or cargo fmt) to format them."],"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-14T05:17:10.506Z"}