DioxusLabs/dioxus · error
bad static root
Error message
bad static root
What it means
`load_template_root` looks up the template's static node for a root op index and `expect`s it to exist. This panic fires when the template's static root list doesn't contain the referenced op — an internal mismatch between compiled templates and the diffing code, not user error.
Source
Thrown at packages/core/src/diff/node.rs:941
Self::write_attribute_to_current(attr, id, mount, dom, to);
}
});
}
fn load_template_root(
&self,
root_anchor_idx: usize,
root_op: usize,
dom: &mut VirtualDom,
to: &mut dyn WriteMutations,
) -> MountedElementId {
let target_id = dom.current_render_target_id();
let id = dom.next_element_in_target(target_id);
let static_root = self
.template()
.static_node(root_op)
.expect("bad static root");
if to.can_cache_template_roots() {
let template_id =
match dom.cached_template_root(target_id, *self.template(), root_anchor_idx) {
Some(id) => id,
None => {
let id = dom.allocate_template_root(
target_id,
*self.template(),
root_anchor_idx,
);
create_static_prototype(static_root, to);
to.set_id(id.element_id());
to.pop();
id
}
};
to.push_id(template_id.element_id());
WriteMutations::clone(to);View on GitHub (pinned to 24f6a829df)
Solutions
- This is an internal invariant about static root nodes. Report it with a minimal reproduction to the Dioxus issue tracker.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at packages/core/src/diff/node.rs:941 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/e585d0b58a7e97aa.
Report an issue: GitHub.