{"record":{"id":"c3f7ae9c856baa9b","repo":"biomejs/biome","slug":"expected-root-for-comments-with-data","errorCode":null,"errorMessage":"Expected root for comments with data","messagePattern":"Expected root for comments with data","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/biome_formatter/src/comments.rs","lineNumber":1017,"sourceCode":"    #[cfg(not(debug_assertions))]\n    pub(crate) fn assert_formatted_all_comments(&self) {}\n\n    #[cfg(debug_assertions)]\n    pub(crate) fn assert_formatted_all_comments(&self) {\n        let has_unformatted_comments = self\n            .data\n            .comments\n            .all_parts()\n            .any(|comment| !comment.formatted.get());\n\n        if has_unformatted_comments {\n            let mut unformatted_comments = Vec::new();\n\n            for node in self\n                .data\n                .root\n                .as_ref()\n                .expect(\"Expected root for comments with data\")\n                .descendants()\n            {\n                unformatted_comments.extend(self.leading_comments(&node).iter().filter_map(\n                    |comment| {\n                        (!comment.formatted.get()).then_some(DebugComment::Leading {\n                            node: node.clone(),\n                            comment,\n                        })\n                    },\n                ));\n                unformatted_comments.extend(self.dangling_comments(&node).iter().filter_map(\n                    |comment| {\n                        (!comment.formatted.get()).then_some(DebugComment::Dangling {\n                            node: node.clone(),\n                            comment,\n                        })\n                    },\n                ));","sourceCodeStart":999,"sourceCodeEnd":1035,"githubUrl":"https://github.com/biomejs/biome/blob/405dedb0ff65dd29927faf587f6542e3c29db248/crates/biome_formatter/src/comments.rs#L999-L1035","documentation":"Error \"Expected root for comments with data\" thrown in biomejs/biome.","triggerScenarios":"Thrown at crates/biome_formatter/src/comments.rs:1017 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 comments iterator only runs on a fully parsed root node."],"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":"405dedb0ff65dd29927faf587f6542e3c29db248","analyzedAt":"2026-08-20T00:25:09.682Z","contentChangedAt":"2026-08-20T00:25:09.682Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}