DioxusLabs/dioxus · error

no live element with `{attr_name}={attr_value}` found in the

Error message

no live element with `{attr_name}={attr_value}` found in the oracle DOM

What it means

`element_id_by_attr` searches the oracle DOM for the unique element whose attribute matches; it panics when zero elements match (the ambiguity case with >1 raises a separate error). It fires when the test/query references an attribute=value pair that doesn't exist on any live element, typically a typo or an element that was never rendered.

Source

Thrown at packages/oracle/src/renderer.rs:1142

        match hits.as_slice() {
            [id] => *id,
            [] => panic!("no live element with tag `{tag}` found in the oracle DOM"),
            many => panic!(
                "tag `{tag}` is ambiguous: {} matching elements (use element_id_by_attr to disambiguate)",
                many.len(),
            ),
        }
    }

    /// Find the live [`ElementId`] of the unique element whose attribute
    /// `attr_name` (in the default namespace) has the value `attr_value`.
    /// Panics if zero or more than one element matches.
    pub fn element_id_by_attr(&self, attr_name: &str, attr_value: &str) -> ElementId {
        let mut hits = Vec::new();
        self.collect_element_ids_by_attr(self.arena.root, attr_name, attr_value, &mut hits);
        match hits.as_slice() {
            [id] => *id,
            [] => panic!("no live element with `{attr_name}={attr_value}` found in the oracle DOM"),
            many => panic!(
                "`{attr_name}={attr_value}` is ambiguous: {} matching elements",
                many.len(),
            ),
        }
    }

    fn collect_element_ids_by_tag(&self, node: NodeId, tag: &str, out: &mut Vec<ElementId>) {
        let n = self.arena.node(node);
        if let NodeKind::Element { tag: t, .. } = &n.kind {
            if t == tag {
                if let Some(id) = self.element_id_for_node(node) {
                    out.push(id);
                }
            }
        }
        for &child in &n.children {
            self.collect_element_ids_by_tag(child, tag, out);

View on GitHub (pinned to 24f6a829df)

Solutions

  1. No live element has that attribute/value pair. Ensure the element with the attribute is rendered before querying.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/oracle/src/renderer.rs:1142 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/cb365844390f674a. Report an issue: GitHub.