{"record":{"id":"69e55def9300fce4","repo":"Hmbown/CodeWhale","slug":"cannot-safely-inspect-git-review-configuration","errorCode":null,"errorMessage":"Cannot safely inspect Git review configuration","messagePattern":"Cannot safely inspect Git review configuration","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/dependencies.rs","lineNumber":445,"sourceCode":"                .env(\"GIT_PAGER\", \"\");\n            Ok(command)\n        };\n        let output = base()?\n            .args([\n                \"config\",\n                \"--null\",\n                \"--name-only\",\n                \"--get-regexp\",\n                r\"^filter\\..*\\.(clean|process|required)$\",\n            ])\n            .output()\n            .context(\"Failed to inspect Git review filters\")?;\n        let no_filters =\n            output.status.code() == Some(1) && output.stdout.is_empty() && output.stderr.is_empty();\n        if (!output.status.success() && !no_filters)\n            || (!output.stdout.is_empty() && !output.stdout.ends_with(&[0]))\n        {\n            bail!(\"Cannot safely inspect Git review configuration\");\n        }\n        let mut filters = std::collections::BTreeSet::new();\n        for key in output\n            .stdout\n            .split(|byte| *byte == 0)\n            .filter(|key| !key.is_empty())\n        {\n            let key =\n                std::str::from_utf8(key).context(\"Git review filter name is not valid UTF-8\")?;\n            let (driver, _) = key\n                .rsplit_once('.')\n                .context(\"Invalid Git review filter key\")?;\n            filters.insert(driver);\n        }\n        let mut command = base()?;\n        let mut count = 2;\n        for driver in filters {\n            for (suffix, value) in [(\"clean\", \"\"), (\"process\", \"\"), (\"required\", \"false\")] {","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/dependencies.rs#L427-L463","documentation":"review_command runs `git config` with -z to list review filters and only trusts the result when the exit code and output shape are exactly what it expects (success with NUL-terminated output, or exit 1 with empty output meaning no filters). Any other combination is treated as an unparseable git state and fails closed rather than allowing a misconfigured review flow.","triggerScenarios":"`git config --get-regexp` (or equivalent filter listing) exits nonzero with visible output, exits with an unexpected code, or emits stdout that does not end in a NUL byte.","commonSituations":"Broken or unusual git installations, aliases/wrappers replacing git, a git config file with corrupt syntax, security tools intercepting git, or a locale/pager injecting output.","solutions":["Run `git config --list` yourself to find and fix the parse error in a config file","Check that `git` on PATH is the real git binary (not a wrapper) and works with --null/-z output","Unset GIT_PAGER/core.pager or environment overrides that could alter output","Inspect `git config -z --get-regexp <filter>` directly and fix the offending config key"],"exampleFix":"// before: broken config makes output non-NUL-terminated\n// after\ngit config --global --unset broken.key # or fix .gitconfig syntax\n// then re-run the review command","handlingStrategy":"try-catch","validationCode":"let out = Command::new(\"git\").args([\"config\",\"-z\",\"--get-regexp\",\"filter.*\"]).output()?;\nlet ok = out.status.success() || (out.status.code() == Some(1) && out.stdout.is_empty());","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"Cannot safely inspect Git review configuration\") => {\n        // inspect git config manually, fix corrupt config, retry\n    }\n    other => other?,\n}","preventionTips":["Keep git config files syntactically valid; validate after edits","Do not alias or wrap `git` on PATH in ways that change output","Disable pagers/GIT_PAGER for scripted git calls"],"tags":["git","config","fail-closed"],"backgroundTag":"git-command-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}