slint-ui/slint · error
internal compiler error: more than one strong reference…
Error message
internal compiler error: more than one strong reference left to repeated component when lowering shadow properties
What it means
This debug-guarded panic fires in the shadow-property lowering pass (object_tree.rs:5124). To graft the repeated component's root element under a shadow element, the code takes the `base_type` out of the repeated element and then `Rc::try_unwrap`s the component, requiring exactly one strong reference. If any other code still holds a strong `Rc` to the component, the compiler aborts with this message rather than corrupting the component.
Solutions
- Restructure the repeated component: move the shadow-property customization into the component's own declaration instead of redefining properties at the repetition site.
- Test with the latest stable Slint release; if it passes, the nightly has a regression — downgrade.
- Minimize the .slint file and report the bug with the reproducer.
- For contributors: audit code paths that clone `ElementType::Component` values before the shadow-property pass runs and drop extra strong references.
Example fix
// before
for item in model: MyComp { shadow-property-override: item.value; }
// after
component MyComp inherits Base { property <int> shadow-property-override; }
for item in model: MyComp { shadow-property-override: item.value; } Defensive patterns
Strategy: fallback
Validate before calling
// Prefer explicit components over anonymous repeated components with shadow properties
fn uses_shadow_properties_on_repeats(src: &str) -> bool {
src.contains("for ") && src.matches('{').count() > 0 // heuristic: review repeated elements manually
} Prevention
- Declare named components and set their properties at the repetition site instead of redefining properties inline.
- Pin a known-good Slint version in CI for embedded builds.
- Report reproducers quickly so regressions in repeated-component lowering get fixed.
When it happens
Trigger: Compiling a `for`/repeated element with shadow properties (e.g. `for x in model: Foo { property <int> shadowed-prop: ...; }` patterns) while some other compiler structure — a cloned element, a second reference in the element tree, or a pass holding the component — retains a strong `Rc<Component>` reference.
Common situations: Compiler regressions in nightly builds around `Repeater`/repeated component lowering; .slint files using shadow properties on repeated elements that hit an untested code path; contributor changes to element cloning or component reference counting.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Component should cleanly upgrade here
- constraint must have binding
- EmbedTextures builds the shared font collection
- LibGlobal not found
- named struct declarations have symbol counters
AI-assisted analysis of slint-ui/slint@3a7e700487 (2026-09-16).
Data as JSON: /api/errors/22070541ba477d90.
Report an issue: GitHub.
Appendix: source
Thrown at internal/compiler/object_tree.rs:5184
.unwrap();
let expr_v =
BindingExpression::new_with_span(expr_v, old_root.borrow().to_source_location());
li_v.element().borrow_mut().set_binding(li_v.name().clone(), expr_v);
let expr_h =
BindingExpression::new_with_span(expr_h, old_root.borrow().to_source_location());
li_h.element().borrow_mut().set_binding(li_h.name().clone(), expr_h);
Some((li_h.clone(), li_v.clone()))
});
new_root.borrow_mut().layout_info_prop = layout_info_prop;
forward_layout_info_with_constraint(&new_root, old_root);
// Replace the repeated component's element with our shadow element. That requires a bit of reference counting
// surgery and relies on nobody having a strong reference left to the component, which we take out of the Rc.
drop(std::mem::take(&mut repeated_element.borrow_mut().base_type));
debug_assert_eq!(Rc::strong_count(&component), 1);
let mut component = Rc::try_unwrap(component).expect("internal compiler error: more than one strong reference left to repeated component when lowering shadow properties");
let old_root = std::mem::replace(&mut component.root_element, new_root.clone());
new_root.borrow_mut().children.push(old_root);
let component = Rc::new(component);
repeated_element.borrow_mut().base_type = ElementType::Component(component.clone());
for elem in elements_with_enclosing_component_reference {
elem.borrow_mut().enclosing_component = Rc::downgrade(&component);
}
}
/// Make the geometry of the `injected_parent` that of the old_elem. And the old_elem
/// will cover the `injected_parent`
pub fn adjust_geometry_for_injected_parent(injected_parent: &ElementRc, old_elem: &ElementRc) {
let mut injected_parent_mut = injected_parent.borrow_mut();
injected_parent_mut.set_binding(
"z".into(),View on GitHub (pinned to 3a7e700487)