DioxusLabs/dioxus · error

bad attr anchor

Error message

bad attr anchor

What it means

Internal invariant: resolving a static attribute value required the anchor to have a parent element op, but the dynamic attribute anchor referenced no static element. Malformed template attribute anchor.

Source

Thrown at packages/core/src/diff/template.rs:587

        self.template_anchor().static_path()
    }

    fn has_same_insertion_parent(self, other: Self) -> bool {
        self.parent_element_op_index() == other.parent_element_op_index()
    }

    pub(super) fn shares_insertion_position(self, other: Self) -> bool {
        self.has_same_insertion_parent(other) && self.slot_target() == other.slot_target()
    }

    pub(super) fn static_attr_value_for_key(
        self,
        key: (&'static str, Option<&'static str>),
    ) -> Option<&'static str> {
        let element_op = self
            .template_anchor()
            .parent_element_op_index()
            .expect("bad attr anchor");
        self.vnode
            .template()
            .static_element(element_op)
            .expect("dynamic attr anchor must reference a static element op")
            .attribute_value(key)
    }
}

#[derive(Clone, Copy)]
/// A dynamic node slot owned by a [`DynamicAnchor`].
pub struct DynamicNodeSlot<'a> {
    anchor: DynamicAnchor<'a>,
    index: usize,
}

impl<'a> DynamicNodeSlot<'a> {
    /// The dynamic anchor that owns this node slot.
    pub fn anchor(self) -> DynamicAnchor<'a> {

View on GitHub (pinned to 24f6a829df)

Solutions

  1. This is an internal invariant about attribute 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/template.rs:587 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/ff590563c4c66158. Report an issue: GitHub.