DioxusLabs/dioxus · error
tag `{tag}` is ambiguous: {} matching elements (use element_
Error message
tag `{tag}` is ambiguous: {} matching elements (use element_id_by_attr to disambiguate) What it means
element_id_by_tag found multiple live elements with the requested tag, so a unique ElementId cannot be returned. The helper requires exactly one match; ambiguous tests should add an id attribute and use element_id_by_attr instead.
Source
Thrown at packages/oracle/src/renderer.rs:1127
}
/// Find the live [`ElementId`] of the unique element whose tag matches
/// `tag` (default namespace). Panics if zero or more than one element
/// matches - tests should make the target unambiguous (add an `id` attr
/// and use [`Self::element_id_by_attr`] instead when multiple elements
/// share a tag).
///
/// This is the entry point for firing synthetic events without naming a
/// specific `ElementId::from_raw(N)` literal in test code: look up the target
/// semantically (by tag or by attribute), then pass the returned id to
/// `vdom.runtime().handle_event(...)`.
pub fn element_id_by_tag(&self, tag: &str) -> ElementId {
let mut hits = Vec::new();
self.collect_element_ids_by_tag(self.arena.root, tag, &mut hits);
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(),View on GitHub (pinned to 24f6a829df)
Solutions
- The tag matches multiple elements. Disambiguate with element_id_by_attr or a more specific selector.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/oracle/src/renderer.rs:1127 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/73f6b3abe9bc904b.
Report an issue: GitHub.