{"record":{"id":"f80190f22db683f3","repo":"Canop/broot","slug":"syntactic-view-without-pattern-shouldn-t-be-none","errorCode":null,"errorMessage":"syntactic view without pattern shouldn't be none","messagePattern":"syntactic view without pattern shouldn't be none","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/preview/preview.rs","lineNumber":99,"sourceCode":"        con: &AppContext,\n    ) -> Result<Self, ProgramError> {\n        if path.is_file() {\n            match mode {\n                PreviewMode::Diff => UnifiedDiffView::new(path, con).map(Self::Diff),\n                PreviewMode::Hex => Ok(HexView::new(path.to_path_buf()).map(Self::Hex)?),\n                PreviewMode::Image => ImageView::new(path).map(Self::Image),\n                PreviewMode::Tty => TtyView::new(path)\n                    .map(Self::Tty)\n                    .map_err(ProgramError::from),\n                PreviewMode::Text => Ok(TextView::new(\n                    path,\n                    InputPattern::none(),\n                    &mut Dam::unlimited(),\n                    con,\n                    false,\n                )\n                .transpose()\n                .expect(\"syntactic view without pattern shouldn't be none\")\n                .map(Self::Text)?),\n            }\n        } else {\n            Ok(Self::dir(\n                path,\n                InputPattern::none(),\n                &Dam::unlimited(),\n                con,\n            ))\n        }\n    }\n\n    /// build a dir preview\n    pub fn dir(\n        path: &Path,\n        pattern: InputPattern,\n        dam: &Dam,\n        con: &AppContext,","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/Canop/broot/blob/17204794d7c564f21d023c31f105c09ac169dd2d/src/preview/preview.rs#L81-L117","documentation":"Invariant check in Preview::with_mode: when building the Text (syntactic) preview for a regular file, the underlying TextView/syntactic view construction unexpectedly returned None even though no pattern filtering applies. Since a syntactic view of a plain file should always succeed, this panic flags an internal assumption violation (e.g. the syntactic view engine failed to produce a view for a readable file).","triggerScenarios":"Thrown at src/preview/preview.rs:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the file is a regular, readable text file before requesting a Text preview","Report the file and mode to broot maintainers — this panic indicates an internal bug, not user error","As a workaround, preview the file in a different mode (Hex, Image, Tty, or Diff)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"17204794d7c564f21d023c31f105c09ac169dd2d","analyzedAt":"2026-09-08T00:58:21.814Z","contentChangedAt":"2026-09-08T00:58:21.814Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}