{"record":{"id":"e671ca29c2bd3bb8","repo":"DioxusLabs/dioxus","slug":"syntax-error-in-line-line-column-column-err","errorCode":null,"errorMessage":"Syntax Error in line {line} column {column}:\n{err}","messagePattern":"Syntax Error in line (.+?) column (.+?):\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/cli/autoformat.rs","lineNumber":255,"sourceCode":"        tab_spaces,\n        split_line_attributes,\n    ))\n}\n\n/// Format rust code using prettyplease\nfn format_rust(input: &str) -> Result<String> {\n    let syntax_tree = syn::parse_file(input)\n        .map_err(format_syn_error)\n        .context(\"Failed to parse Rust syntax\")?;\n    let output = prettyplease::unparse(&syntax_tree);\n    Ok(output)\n}\n\nfn format_syn_error(err: syn::Error) -> Error {\n    let start = err.span().start();\n    let line = start.line;\n    let column = start.column;\n    anyhow::anyhow!(\"Syntax Error in line {line} column {column}:\\n{err}\")\n}\n\n#[tokio::test]\nasync fn test_auto_fmt() {\n    let test_rsx = r#\"\n                    //\n\n\n\n                        div {}\n\n\n                    //\n                    //\n                    //\n\n                    \"#\n    .to_string();","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/cli/autoformat.rs#L237-L273","documentation":"Conversion of a syn::parse_file failure into an anyhow error by format_syn_error, embedding the line and column of the offending span. Fires during `dx fmt` when the source passed to format_rust is not valid Rust — typically partially edited or incomplete code inside an rsx! macro — so prettyplease cannot reformat it.","triggerScenarios":"Thrown at packages/cli/src/cli/autoformat.rs:255 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["There is an RSX syntax error at the reported line and column. Fix the syntax and re-run dx fmt."],"exampleFix":null,"handlingStrategy":"fallback","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-23T08:17:48.524Z"}