{"record":{"id":"464a4b1b8b20dba0","repo":"GitoxideLabs/gitoxide","slug":"diff-pager-exited-with-status","errorCode":null,"errorMessage":"diff pager exited with {status}","messagePattern":"diff pager exited with (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"gix-tix/src/lib.rs","lineNumber":6114,"sourceCode":"    if status.success() || status.code() == Some(1) {\n        Ok(())\n    } else {\n        anyhow::bail!(\"external diff exited with {status}\")\n    }\n}\n\nfn pager_write_result(result: io::Result<()>) -> Result<()> {\n    match result {\n        Err(err) if err.kind() == io::ErrorKind::BrokenPipe => Ok(()),\n        result => result.context(\"could not write diff to pager\"),\n    }\n}\n\nfn pager_status(status: ExitStatus) -> Result<()> {\n    if status.success() {\n        Ok(())\n    } else {\n        anyhow::bail!(\"diff pager exited with {status}\")\n    }\n}\n\nfn pager_needs_acknowledgement(elapsed: Duration) -> bool {\n    elapsed <= IMMEDIATE_PAGER_EXIT\n}\n\nfn show_builtin_diff(terminal: &mut ratatui::DefaultTerminal, diff: &BuiltInDiff) -> Result<bool> {\n    let mut offset = 0usize;\n    let mut horizontal_offset = 0usize;\n    let mut focused = true;\n    loop {\n        let size = terminal.size().context(\"could not determine diff viewport\")?;\n        let page = usize::from(size.height.saturating_sub(2)).max(1);\n        let max = diff.display_line_count().saturating_sub(page);\n        let horizontal_page = usize::from(size.width).max(1);\n        let horizontal_max = diff.max_width.saturating_sub(horizontal_page);\n        offset = offset.min(max);","sourceCodeStart":6096,"sourceCodeEnd":6132,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/lib.rs#L6096-L6132","documentation":"The pager process used to display diff output (e.g. configured core.pager or the built-in pager) exited with a non-zero status. A non-successful pager exit usually means the pager crashed or was killed, not that the diff itself failed.","triggerScenarios":"After streaming the diff into the pager and waiting, pager_status() observes ExitStatus that is not success — pager killed by a signal, pager binary missing its dependencies, or pager exiting with an error.","commonSituations":"less exiting via signal (e.g. SIGKILL/OOM); a custom core.pager script failing; PAGER env var pointing at a non-pager command that returns non-zero.","solutions":["Check which pager is configured (core.pager, GIT_PAGER, PAGER) and test it standalone.","Reset to a known-good pager: git config --unset core.pager or use `less`.","If the pager was killed (signal), check memory/ulimits and shell pipeline behavior.","Bypass the pager (e.g. --no-pager equivalent / pipe to file) to isolate the issue."],"exampleFix":"// before\nGIT_PAGER='mypager.sh' gix diff\n// after\nGIT_PAGER='less -FRX' gix diff","handlingStrategy":"try-catch","validationCode":"let pager = std::env::var(\"GIT_PAGER\").or_else(|_| std::env::var(\"PAGER\")).unwrap_or_default();\nif !pager.is_empty() && which::which(pager.split_whitespace().next().unwrap_or_default()).is_err() { /* bad pager */ }","typeGuard":null,"tryCatchPattern":"match show_diff_in_pager(...) {\n    Err(err) if err.to_string().starts_with(\"diff pager exited with\") => {\n        eprintln!(\"pager failed; printing to stdout instead\");\n    }\n    other => other?,\n}","preventionTips":["Point GIT_PAGER/core.pager at a robust pager like `less -FRX`.","Test the configured pager standalone with sample input.","Check ulimits/memory if pagers get killed on large diffs."],"tags":["pager","subprocess","exit-code","diff"],"backgroundTag":"pager-exited-nonzero","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}