{"record":{"id":"b767346437fec017","repo":"biomejs/biome","slug":"expected-enclosing-nodes-to-at-least-contain-the-r","errorCode":null,"errorMessage":"Expected enclosing nodes to at least contain the root node.","messagePattern":"Expected enclosing nodes to at least contain the root node\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/biome_formatter/src/comments/builder.rs","lineNumber":250,"sourceCode":"        if let Some(following_node) = self.following_node() {\n            self.flush_comments(Some(&following_node.clone()));\n            self.following_node_index = None;\n\n            // The following node is only set after entering a node\n            // That means, following node is only set for the first token of a node.\n            // Unset preceding node if this is the first token because the preceding node belongs to the parent.\n            self.preceding_node = None;\n        }\n    }\n\n    fn enclosing_node(&self) -> &SyntaxNode<Style::Language> {\n        let element = match self.following_node_index {\n            None => self.parents.last(),\n            Some(0) => Some(&self.parents[0]),\n            Some(index) => Some(&self.parents[index - 1]),\n        };\n\n        element.expect(\"Expected enclosing nodes to at least contain the root node.\")\n    }\n\n    fn following_node(&self) -> Option<&SyntaxNode<Style::Language>> {\n        self.following_node_index.map(|index| {\n            self.parents\n                .get(index)\n                .expect(\"Expected following node index to point to a valid parent node\")\n        })\n    }\n\n    fn queue_comment(&mut self, comment: DecoratedComment<Style::Language>) {\n        self.pending_comments.push(comment);\n    }\n\n    fn update_comments(\n        comments: &mut [DecoratedComment<Style::Language>],\n        position: CommentTextPosition,\n        lines_before: u32,","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/biomejs/biome/blob/45a19bbf1747401274f1be1f9f89d6af91367190/crates/biome_formatter/src/comments/builder.rs#L232-L268","documentation":"Error \"Expected enclosing nodes to at least contain the root node.\" thrown in biomejs/biome.","triggerScenarios":"Thrown at crates/biome_formatter/src/comments/builder.rs:246 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This is an internal formatter invariant violation; report it as a Biome bug with the source file that triggered it.","Ensure the node passed to the comments builder belongs to the root's syntax tree."],"exampleFix":"// Report at https://github.com/biomejs/biome/issues with a minimal repro","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"45a19bbf1747401274f1be1f9f89d6af91367190","analyzedAt":"2026-08-20T00:25:09.682Z","contentChangedAt":"2026-08-20T00:25:09.682Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}