{"record":{"id":"d7146d2c42052eb0","repo":"GitoxideLabs/gitoxide","slug":"field-must-be-written-as-name-email","errorCode":null,"errorMessage":"{field} must be written as Name <email>","messagePattern":"(.+?) must be written as Name <email>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/reword.rs","lineNumber":458,"sourceCode":"}\n\nfn trim_cr(line: &[u8]) -> &[u8] {\n    line.strip_suffix(b\"\\r\").unwrap_or(line)\n}\n\nfn date(value: &[u8], field: &str) -> Result<gix::date::Time> {\n    let value = std::str::from_utf8(value).with_context(|| format!(\"{field} date is not UTF-8\"))?;\n    gix::date::parse(value, None)\n        .map_err(|err| anyhow::Error::new(err.into_error()))\n        .with_context(|| format!(\"could not parse {field} date\"))\n}\n\npub(super) fn actor(value: &[u8], time: gix::date::Time, field: &str) -> Result<gix::actor::Signature> {\n    let parsed = gix::actor::SignatureRef::from_bytes(value)\n        .with_context(|| format!(\"could not parse {field} identity\"))?\n        .trim();\n    if parsed.name.is_empty() || parsed.email.is_empty() || !parsed.time.is_empty() {\n        anyhow::bail!(\"{field} must be written as Name <email>\");\n    }\n    Ok(gix::actor::Signature {\n        name: parsed.name.into(),\n        email: parsed.email.into(),\n        time,\n    })\n}\n\n#[cfg(test)]\nmod tests {\n    use std::process::Command;\n\n    use super::*;\n\n    #[test]\n    fn parses_the_edit_document() -> gix_testtools::Result {\n        let input = b\"Author: A U Thor <author@example.com>\\n\\\n                      AuthorDate: 2026-08-12 10:20:30 +0200\\n\\","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/reword.rs#L440-L476","documentation":"Identity headers (Author/Committer) in the edit document must be exactly `Name <email>` — no empty name/email and no trailing time component, because the time is supplied separately as `gix::date::Time`. `actor` parses the value with `gix::actor::SignatureRef::from_bytes` and bails with this error when name or email is empty or the parsed time field is non-empty.","triggerScenarios":"Calling `actor` (via `document_with_author`, `apply_conflict_reporting`, or `apply_message_reporting`) with a `value` like `\"\"`, `\"<a@b>\"`, `\"Name\"`, `\"Name <>\"`, or `\"Name <a@b> 1700000000 +0100\"` — i.e. anything whose parsed name/email is empty or that carries an embedded timestamp.","commonSituations":"Copying a raw git signature line (which includes the timestamp) into the document; leaving the author line blank; forgetting the `<email>` part; scripted header generation writing incomplete identities.","solutions":["Write the identity as `Name <email>` with both parts non-empty and no timestamp.","Strip the time component if you copied a raw commit signature line.","Fill in the author name/email in your git config or pass a complete identity programmatically.","If `from_bytes` itself fails, the underlying 'could not parse {field} identity' error points at the malformed bytes."],"exampleFix":"// before (document header)\nAuthor:  <dev@example.com> 1700000000 +0100\n// after\nAuthor: Jane Dev <dev@example.com>","handlingStrategy":"validation","validationCode":"fn identity_well_formed(value: &[u8]) -> bool {\n    gix::actor::SignatureRef::from_bytes(value)\n        .ok()\n        .and_then(|s| s.trim().ok())\n        .map_or(false, |s| !s.name.is_empty() && !s.email.is_empty() && s.time.is_empty())\n}","typeGuard":null,"tryCatchPattern":"match document_with_author(repo, old_id, author_value, time) {\n    Ok(doc) => doc,\n    Err(e) if e.to_string().contains(\"must be written as Name <email>\") => {\n        eprintln!(\"Author must look like: Jane Dev <jane@example.com> (no timestamp).\");\n        Err(e)\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Never paste raw git signature lines (which embed a timestamp) into identity headers.","Ensure git user.name and user.email are configured so defaults are complete.","Validate identity strings with `SignatureRef::from_bytes` plus the trim checks before writing documents."],"tags":["git","signature","identity","validation","format"],"backgroundTag":"invalid-argument-format","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}