{"record":{"id":"0781b5c6fa41bffe","repo":"gitbutlerapp/gitbutler","slug":"line-should-have-been-highlighted-by-now","errorCode":null,"errorMessage":"line should have been highlighted by now","messagePattern":"line should have been highlighted by now","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/but/src/command/legacy/status/tui/details.rs","lineNumber":1034,"sourceCode":"                    if highlight_lines.is_none() {\n                        let syntax = line.syntax(syntax_set);\n                        *highlight_lines = Some(HighlightLines::new(syntax, syntax_theme));\n                    }\n\n                    let id = line.id;\n                    let mut strings = self.strings.lock();\n\n                    line.ensure_highlighted(\n                        syntax_set,\n                        highlight_lines.as_mut().unwrap(),\n                        self.theme,\n                        &mut strings,\n                    );\n\n                    let syntax_highlighted_line = line.syntax_highlighted_line.borrow();\n                    let syntax_highlighted_line = syntax_highlighted_line\n                        .as_ref()\n                        .expect(\"line should have been highlighted by now\");\n\n                    if self.section_is_to_be_discarded(id) {\n                        let crossed_out_line = syntax_highlighted_line\n                            .spans\n                            .iter()\n                            .cloned()\n                            .map(|span| span.crossed_out())\n                            .collect::<Line<'_>>()\n                            .style(syntax_highlighted_line.style);\n                        frame.render_widget(crossed_out_line, line_area);\n                    } else {\n                        frame.render_widget(syntax_highlighted_line, line_area);\n                    }\n\n                    if line\n                        .cli_id\n                        .as_ref()\n                        .is_some_and(|id| marks.contains_cli_id(id))","sourceCodeStart":1016,"sourceCodeEnd":1052,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/status/tui/details.rs#L1016-L1052","documentation":"A developer panic (`.expect`) in the TUI details renderer: by the time `render_details_line` draws a line, an earlier background pass should have populated `line.syntax_highlighted_line`. If it is still `None`, the invariant 'every rendered line was highlighted' is broken and the app panics with this message instead of rendering unhighlighted text.","triggerScenarios":"Rendering a details/diff line whose syntax highlighting task never ran or never completed before the draw, e.g. a line added to the list after the highlighting pass, or the highlight computation was skipped/failed for that line.","commonSituations":"Rapidly scrolling or resizing so new lines are drawn before highlighting catches up; a syntax-highlighting failure for an unusual file type; races between the async highlighter and the render loop on freshly loaded diffs.","solutions":["Report it as a bug — this is an internal invariant violation, not user error.","Work around by scrolling away from the affected region or resizing the terminal to force a redraw.","Update GitButler; check for a fixed version referencing this panic.","If reproducible, capture the file type and diff state that triggers it and file an issue."],"exampleFix":"// before\nlet line = syntax_highlighted_line.as_ref().expect(\"line should have been highlighted by now\");\n// after\nlet Some(line) = syntax_highlighted_line.as_ref() else {\n    strings.push(Line::raw(raw_line));\n    return;\n};","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the highlighting pass ahead of the render pass; enqueue highlights when lines are added.","Render raw text when highlighting is not yet available instead of panicking.","Update to the latest GitButler release and report reproducible panics with the triggering diff."],"tags":["tui","panic","invariant","rendering"],"backgroundTag":"internal-invariant-violation","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}