DioxusLabs/dioxus · error

dynamic anchor has nodes

Error message

dynamic anchor has nodes

What it means

`load_dynamic_anchor` takes the first slot of a dynamic anchor's nodes and `expect`s at least one node to exist. This panic fires if a dynamic anchor somehow has zero nodes — an internal template invariant violation indicating a bug in template generation or diffing.

Source

Thrown at packages/core/src/diff/node.rs:901

            .map(|slot| self.create_dynamic_node(mount, slot.index(), state))
            .sum()
    }

    fn load_dynamic_anchor(
        &self,
        mount: MountId,
        anchor: DynamicAnchor<'_>,
        state: &mut DiffState<'_, '_, '_, '_>,
    ) {
        let context = state.context();
        let Some(to) = state.to.as_deref_mut() else {
            for slot in anchor.nodes() {
                self.create_dynamic_node(mount, slot.index(), state);
            }
            return;
        };

        let first_slot = anchor.nodes().next().expect("dynamic anchor has nodes");
        let site = insertion_site_for_slot(mount, first_slot, state.dom, context);
        let runtime = state.dom.runtime.clone();
        let dom = &mut *state.dom;

        site.create_and_place_with_result(to, runtime, |to| {
            let mut state = DiffState::new_with_context(dom, Some(to), context);
            let nodes = self.create_dynamic_anchor_nodes(mount, anchor, &mut state);
            (nodes, nodes)
        });
    }

    fn write_attr_anchor(
        &self,
        mount: MountId,
        anchor: DynamicAnchor<'_>,
        dom: &mut VirtualDom,
        to: &mut dyn WriteMutations,
    ) {

View on GitHub (pinned to 24f6a829df)

Solutions

  1. This is an internal invariant about dynamic anchors. 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:901 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/80dfd89a5ec2571d. Report an issue: GitHub.