DioxusLabs/dioxus · error · syn::Error
unmatched closing '}' in format string
Error message
unmatched closing '}' in format string
What it means
The ifmt (inline format string) parser errors when a format string contains a single '}' that is not an escaped '}}'. An unbalanced closing brace inside `"...{field}...}"` makes the captured-segment scan run off the end, so the string is rejected at compile time.
Solutions
- Balance the braces in the format string; escape a literal closing brace as `}}`.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/rsx/src/ifmt.rs:178 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of DioxusLabs/dioxus@fda3dc9c2b (2026-08-23).
Data as JSON: /api/errors/25c4cc2834123f18.
Report an issue: GitHub.
Appendix: source
Thrown at packages/rsx/src/ifmt.rs:178
}
break;
}
if c == '}' {
segments.push(Segment::Formatted(FormattedSegment {
format_args: String::new(),
segment: FormattedSegmentType::parse(¤t_captured)?,
}));
break;
}
current_captured.push(c);
}
} else {
if '}' == c {
if let Some(c) = chars.next_if(|c| *c == '}') {
current_literal.push(c);
continue;
} else {
return Err(Error::new(
Span::call_site(),
"unmatched closing '}' in format string",
));
}
}
current_literal.push(c);
}
}
if !current_literal.is_empty() {
segments.push(Segment::Literal(current_literal));
}
Ok(segments)
}
}
impl ToTokens for IfmtInput {View on GitHub (pinned to fda3dc9c2b)