{"record":{"id":"44bb695087309e35","repo":"gitbutlerapp/gitbutler","slug":"could-not-read-repository-local-git-configuration","errorCode":null,"errorMessage":"Could not read repository-local Git configuration: {}","messagePattern":"Could not read repository-local Git configuration: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-debug/src/command/dump/repo_installer.rs","lineNumber":210,"sourceCode":"        );\n    }\n    Ok(())\n}\n\nfn selected_local_config(workdir: &Path) -> Result<Vec<u8>> {\n    let output = git_command(workdir)?\n        .args([\n            \"config\",\n            \"--local\",\n            \"--includes\",\n            \"--null\",\n            \"--get-regexp\",\n            r\"^(gitbutler\\.|remote\\.|log\\.excludedecoration$)\",\n        ])\n        .output()\n        .context(\"Could not read repository-local Git configuration\")?;\n    if !output.status.success() && output.status.code() != Some(1) {\n        bail!(\n            \"Could not read repository-local Git configuration: {}\",\n            String::from_utf8_lossy(&output.stderr).trim()\n        );\n    }\n\n    let mut selected = Vec::with_capacity(output.stdout.len());\n    for record in output.stdout.split(|byte| *byte == 0) {\n        if record.is_empty() {\n            continue;\n        }\n        let key_end = record\n            .iter()\n            .position(|byte| *byte == b'\\n')\n            .context(\"Git configuration record did not contain a value\")?;\n        let key = &record[..key_end];\n        if is_storage_path_key(key) {\n            continue;\n        }","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-debug/src/command/dump/repo_installer.rs#L192-L228","documentation":"selected_local_config runs `git config --local --get-regexp '^(gitbutler\\.|remote\\.|log\\.excludedecoration$)'` to snapshot repository-local config for the dump. If git exits non-zero with any code other than 1 (1 means 'no matches', which is tolerated), the function bails including git's trimmed stderr.","triggerScenarios":"Calling selected_local_config (from run) where the `git config --local --get-regexp` process fails with an unexpected exit code — typically a corrupt or unreadable .git/config file.","commonSituations":"Malformed repository-local config (syntax error in .git/config), permission problems reading the config file, or a broken GIT_CONFIG environment pointing git at an inaccessible config.","solutions":["Read the stderr in the message; fix the underlying git config problem it reports","Validate .git/config with `git config --local --list` and repair any syntax errors","Check file permissions on .git/config for the user running the dump","If you intentionally have no matching keys, note exit code 1 is already tolerated — only other failures raise this"],"exampleFix":"// before\n// .git/config contains a syntax error -> git exits 128\nlet cfg = installer.selected_local_config(repo_path)?;\n// after\n// fix config first:\n//   git config --local --list   # reproduce the parse error\n// repair the bad line, then:\nlet cfg = installer.selected_local_config(repo_path)?;","handlingStrategy":"try-catch","validationCode":"let ok = Command::new(\"git\").args([\"config\", \"--local\", \"--list\"])\n    .current_dir(&repo_path).output()?.status.success();\nif !ok { anyhow::bail!(\"repository-local git config is unreadable/corrupt\"); }","typeGuard":null,"tryCatchPattern":"match installer.selected_local_config(&repo_path) {\n    Err(e) if e.to_string().contains(\"Could not read repository-local Git configuration\") => {\n        eprintln!(\"fix .git/config: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Keep .git/config syntactically valid; validate after hand edits","Check config file permissions before running dumps","Remember exit code 1 (no matches) is tolerated; only real failures throw"],"tags":["git","config","dump","subprocess"],"backgroundTag":"git-command-failed","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"}