DioxusLabs/dioxus · error · syn::Error
Failed emit valid rsx - likely due to partially complete…
Error message
Failed emit valid rsx - likely due to partially complete expressions in the rsx! macro
What it means
Raised in autofmt try_fmt_file when write_rsx_call fails after successfully parsing the macro: the formatter could not emit valid rsx for the parsed CallBody. This happens with partially complete expressions inside rsx! — the file is left unformatted rather than corrupted.
Solutions
- The rsx! macro contains partially complete expressions, so formatting failed. Complete the expressions and re-run the formatter.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/autofmt/src/lib.rs:102 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/c38d8b188011d438.
Report an issue: GitHub.
Appendix: source
Thrown at packages/autofmt/src/lib.rs:102
// this macro is inside the last macro we parsed, skip it
if macro_path.span().start() < end_span {
continue;
}
let body = item.parse_body_with(CallBody::parse_strict)?;
let rsx_start = macro_path.span().start();
writer.out.indent_level = writer
.out
.indent
.count_indents(writer.src.get(rsx_start.line - 1).unwrap_or(&""));
// TESTME
// Writing *should* not fail but it's possible that it does
if writer.write_rsx_call(&body).is_err() {
let span = writer.invalid_exprs.pop().unwrap_or_else(Span::call_site);
return Err(syn::Error::new(
span,
"Failed emit valid rsx - likely due to partially complete expressions in the rsx! macro",
));
}
// writing idents leaves the final line ended at the end of the last ident
if writer.out.buf.contains('\n') {
_ = writer.out.new_line();
_ = writer.out.tab();
}
let span = item.delimiter.span().join();
let mut formatted = writer.out.buf.split_off(0);
let start = collect_macros::byte_offset(contents, span.start()) + 1;
let end = collect_macros::byte_offset(contents, span.end()) - 1;
// Rustfmt will remove the space between the macro and the opening paren if the macro is a single expression
let body_is_solo_expr = body.body().roots.len() == 1View on GitHub (pinned to 24f6a829df)