{"record":{"id":"73f6b3abe9bc904b","repo":"DioxusLabs/dioxus","slug":"tag-tag-is-ambiguous-matching-elements-us","errorCode":null,"errorMessage":"tag `{tag}` is ambiguous: {} matching elements (use element_id_by_attr to disambiguate)","messagePattern":"tag `(.+?)` is ambiguous: (.+?) matching elements \\(use element_id_by_attr to disambiguate\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/oracle/src/renderer.rs","lineNumber":1127,"sourceCode":"    }\n\n    /// Find the live [`ElementId`] of the unique element whose tag matches\n    /// `tag` (default namespace). Panics if zero or more than one element\n    /// matches - tests should make the target unambiguous (add an `id` attr\n    /// and use [`Self::element_id_by_attr`] instead when multiple elements\n    /// share a tag).\n    ///\n    /// This is the entry point for firing synthetic events without naming a\n    /// specific `ElementId::from_raw(N)` literal in test code: look up the target\n    /// semantically (by tag or by attribute), then pass the returned id to\n    /// `vdom.runtime().handle_event(...)`.\n    pub fn element_id_by_tag(&self, tag: &str) -> ElementId {\n        let mut hits = Vec::new();\n        self.collect_element_ids_by_tag(self.arena.root, tag, &mut hits);\n        match hits.as_slice() {\n            [id] => *id,\n            [] => panic!(\"no live element with tag `{tag}` found in the oracle DOM\"),\n            many => panic!(\n                \"tag `{tag}` is ambiguous: {} matching elements (use element_id_by_attr to disambiguate)\",\n                many.len(),\n            ),\n        }\n    }\n\n    /// Find the live [`ElementId`] of the unique element whose attribute\n    /// `attr_name` (in the default namespace) has the value `attr_value`.\n    /// Panics if zero or more than one element matches.\n    pub fn element_id_by_attr(&self, attr_name: &str, attr_value: &str) -> ElementId {\n        let mut hits = Vec::new();\n        self.collect_element_ids_by_attr(self.arena.root, attr_name, attr_value, &mut hits);\n        match hits.as_slice() {\n            [id] => *id,\n            [] => panic!(\"no live element with `{attr_name}={attr_value}` found in the oracle DOM\"),\n            many => panic!(\n                \"`{attr_name}={attr_value}` is ambiguous: {} matching elements\",\n                many.len(),","sourceCodeStart":1109,"sourceCodeEnd":1145,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/oracle/src/renderer.rs#L1109-L1145","documentation":"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.","triggerScenarios":"Thrown at packages/oracle/src/renderer.rs:1127 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The tag matches multiple elements. Disambiguate with element_id_by_attr or a more specific selector."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}