{"record":{"id":"36b209f78ddd7e7c","repo":"zed-industries/zed","slug":"a11ysubtreebuilder-exists-only-while-its-element-s","errorCode":null,"errorMessage":"A11ySubtreeBuilder exists only while its element's node is on the stack","messagePattern":"A11ySubtreeBuilder exists only while its element's node is on the stack","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui/src/window/a11y.rs","lineNumber":363,"sourceCode":"        if pushed {\n            self.nodes.record_node_info(\n                id,\n                debug::NodeDebugInfo {\n                    synthetic: true,\n                    view: self.creator.view,\n                    element_id: self.creator.element_id.clone(),\n                    source_location: self.creator.source_location,\n                },\n            );\n        }\n        pushed\n    }\n\n    /// A mutable reference to the parent node.\n    pub fn parent_node(&mut self) -> &mut accesskit::Node {\n        self.nodes\n            .current_node_mut()\n            .expect(\"A11ySubtreeBuilder exists only while its element's node is on the stack\")\n    }\n}\n\npub(crate) struct A11yNodeBuilder {\n    ids_stack: SmallVec<[NodeId; 16]>,\n    nodes_stack: SmallVec<[accesskit::Node; 16]>,\n    /// This is the exact type required by accesskit, so we can't just make it a\n    /// `HashMap<NodeId, Node>` to remove the need for `seen_ids`\n    all_nodes: Vec<(NodeId, accesskit::Node)>,\n    seen_ids: FxHashSet<NodeId>,\n    /// The node that GPUI considers focused. Note that this may be different to\n    /// what is reported to accesskit - see [`Self::active_descendant`]\n    focus: Option<NodeId>,\n    /// If a node calls `.aria_active_descendant()`, AND an ancestor is focused,\n    /// override it as the focused node. This supports the \"active descendant\"\n    /// pattern, which allows a focused container to act as if a descendant is\n    /// focused.\n    active_descendant: Option<NodeId>,","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui/src/window/a11y.rs#L345-L381","documentation":"A11ySubtreeBuilder::parent_node expects a current node on the accesskit node stack; the builder only exists while its element's node is pushed. Panicking means parent_node was called when no node is active — builder used outside its element's push/pop scope or unbalanced pushes/pops.","triggerScenarios":"Thrown at crates/gpui/src/window/a11y.rs:363 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Only call parent_node between the matching push of the element's node and its pop","Check push/pop pairing, especially around early returns in accessibility tree building","Verify the builder isn't retained beyond its element's subtree construction"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}