{"record":{"id":"bde9b98a6e308d51","repo":"GitoxideLabs/gitoxide","slug":"err-re-raised-mailmap-error-via-bail-err","errorCode":null,"errorMessage":"{err} (re-raised mailmap error via bail!(err))","messagePattern":"(.+?) \\(re-raised mailmap error via bail!\\(err\\)\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"gitoxide-core/src/repository/mailmap.rs","lineNumber":69,"sourceCode":"}\n\npub fn check(\n    repo: gix::Repository,\n    format: OutputFormat,\n    contacts: Vec<BString>,\n    mut out: impl io::Write,\n    mut err: impl io::Write,\n) -> anyhow::Result<()> {\n    if format != OutputFormat::Human {\n        bail!(\"Only human output is supported right now\");\n    }\n    if contacts.is_empty() {\n        bail!(\"specify at least one contact to run through the mailmap\")\n    }\n\n    let mut mailmap = gix::mailmap::Snapshot::default();\n    if let Err(err) = repo.open_mailmap_into(&mut mailmap) {\n        bail!(err);\n    }\n\n    let mut buf = Vec::new();\n    for contact in contacts {\n        let actor = match gix::actor::IdentityRef::from_bytes(&contact) {\n            Ok(a) => a,\n            Err(_) => {\n                let Some(email) = contact\n                    .trim_start()\n                    .strip_prefix(b\"<\")\n                    .and_then(|rest| rest.trim_end().strip_suffix(b\">\"))\n                else {\n                    writeln!(err, \"Failed to parse contact '{contact}' - skipping\")?;\n                    continue;\n                };\n                gix::actor::IdentityRef {\n                    name: \"\".into(),\n                    email: email.into(),","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gitoxide-core/src/repository/mailmap.rs#L51-L87","documentation":"While running `gix mailmap check`, the call to `repo.open_mailmap_into(&mut mailmap)` failed and the error is re-raised verbatim via `bail!(err)`. The parenthetical in the message is an annotation; the actual content is the underlying mailmap-open error (parse or IO failure while loading .mailmap files from the repository).","triggerScenarios":"`repo.open_mailmap_into()` returns Err — typically because a `.mailmap` file (repository or worktree level) is unreadable or malformed — and the check function forwards that error.","commonSituations":"A malformed `.mailmap` entry in the repo; permission problems reading `.mailmap`; running in an environment where the mailmap file cannot be opened (e.g. bare repo with unexpected mailmap config).","solutions":["Inspect the underlying error text for the real cause and fix the `.mailmap` file syntax","Check file permissions on `.mailmap`","Temporarily rename/remove `.mailmap` to confirm it is the source","Use `git check-mailmap` to cross-validate mailmap entries"],"exampleFix":"# before (.mailmap)\nProper Name <proper@email> <bad>\n# after\nProper Name <proper@email> <commit@email>","handlingStrategy":"try-catch","validationCode":"// pre-validate: ensure .mailmap exists and is readable where expected\nif repo_dir.join(\".mailmap\").is_file() && std::fs::metadata(repo_dir.join(\".mailmap\")).is_err() {\n    eprintln!(\".mailmap unreadable\");\n}\n","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"mailmap\") => {\n        eprintln!(\"mailmap load failed: {e}; check .mailmap syntax/permissions\");\n    }\n    other => other?,\n}\n","preventionTips":["Lint `.mailmap` entries (each entry needs a valid name/email pair)","Check file permissions before running","Cross-check with `git check-mailmap`"],"tags":["mailmap","git","error-propagation"],"backgroundTag":"git-command-failed","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"}