{"record":{"id":"f5599964ef232b26","repo":"GitoxideLabs/gitoxide","slug":"could-not-parse-field-date","errorCode":null,"errorMessage":"could not parse {field} date","messagePattern":"could not parse (.+?) date","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/reword.rs","lineNumber":449,"sourceCode":"    }\n    out.into()\n}\n\nfn header<'a>(line: Option<&'a [u8]>, prefix: &[u8]) -> Result<&'a [u8]> {\n    trim_cr(line.context(\"a commit header is missing\")?)\n        .strip_prefix(prefix)\n        .filter(|value| !value.is_empty())\n        .with_context(|| format!(\"expected a non-empty {} header\", prefix[..prefix.len() - 2].as_bstr()))\n}\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)]","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/reword.rs#L431-L467","documentation":"Raised while parsing a reword/commit edit: the `author` or `committer` date string extracted from an instruction line could not be parsed by `gix::date::parse`. The date text must be UTF-8 and match a date format gitoxide understands.","triggerScenarios":"`gix::date::parse()` fails on the value of an author/committer field when parsing a reword instruction (e.g. in interactive-rebase todo-style edits).","commonSituations":"Hand-edited rebase todo files with malformed or nonstandard date strings; dates in formats unsupported by gix (e.g. unusual RFC forms or locale formats); non-UTF-8 bytes in the date field (that raises a distinct 'not UTF-8' context first).","solutions":["Use a canonical date format such as ISO 8601 (`2024-01-15T10:30:00+00:00`) or a raw unix epoch timestamp with offset (`@1705314600 +0000`)","Validate the date string with `gix::date::parse` before writing it into the edit/instruction","Fix encoding issues so the field is valid UTF-8"],"exampleFix":"// before\ncommitter Foo <f@x> Not A Date\n// after\ncommitter Foo <f@x> 2024-01-15T10:30:00+00:00","handlingStrategy":"validation","validationCode":"fn valid_date(s: &str) -> bool {\n    gix::date::parse(s, None).is_ok()\n}\n// call before building the edit instruction","typeGuard":null,"tryCatchPattern":"match gix::date::parse(value, None) {\n    Ok(time) => /* use time */,\n    Err(e) => eprintln!(\"invalid {field} date {:?}: {}\", value, e),\n}","preventionTips":["Only write dates in formats gix understands (ISO 8601 or `@<epoch> <offset>`)","Round-trip test dates through gix::date::parse before persisting todo/edit files","Ensure input files are valid UTF-8 and trimmed of stray whitespace"],"tags":["rust","date-parsing","git","rebase"],"backgroundTag":"invalid-date-format","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"}