DioxusLabs/dioxus · error

stable child must be reused

Error message

stable child must be reused

What it means

Internal diffing invariant: the fragment placement plan marked a child as stable (reused from the old tree) but new_to_old held no mapping for it. Indicates a bug in keyed-children diffing plan construction.

Source

Thrown at packages/core/src/diff/iterator.rs:393

        plan: FragmentPlacementPlan,
        fallback_site: Option<InsertionSite>,
    ) {
        let FragmentInputs {
            old,
            old_mounts,
            new,
            new_children,
            new_offset,
            ..
        } = inputs;
        let mut new_mounts = vec![None; new.len()];
        let mut anchorable = plan.stable.clone();

        for idx in 0..new.len() {
            if !plan.stable[idx] {
                continue;
            }
            let old_index = plan.new_to_old[idx].expect("stable child must be reused");
            let old_mount = old_mounts[old_index];
            self.dom
                .stage_mounted_fragment_child(new_children, new_offset + idx, old_mount);
            let mount = DiffFrame::new(old_mount, &old[old_index], &new[idx]).diff_into(self);
            new_mounts[idx] = Some(mount);
            self.dom
                .set_mounted_fragment_child(new_children, new_offset + idx, mount);
            if mount != old_mount {
                anchorable[idx] = false;
            }
        }

        let stable_edges = StableFragmentEdges::new(new, &new_mounts, &anchorable, self.dom);
        for range in plan.placement_runs(&stable_edges.live_stable) {
            let context = self.context();
            let runtime = self.dom.runtime.clone();
            let dom = &mut *self.dom;
            let mut replaced_nodes = Vec::new();

View on GitHub (pinned to 24f6a829df)

Solutions

  1. This is an internal diffing invariant about reusing stable children. 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/iterator.rs:393 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/a7a3b333cdb20d1d. Report an issue: GitHub.