{"record":{"id":"99b8e8d0af6c781b","repo":"zed-industries/zed","slug":"invalid-status-code-byte","errorCode":null,"errorMessage":"Invalid status code: {byte}","messagePattern":"Invalid status code: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/git/src/status.rs","lineNumber":235,"sourceCode":"                conflict: 0,\n                untracked: 0,\n                count: 1,\n            },\n        }\n    }\n}\n\nimpl StatusCode {\n    fn from_byte(byte: u8) -> anyhow::Result<Self> {\n        match byte {\n            b'M' => Ok(StatusCode::Modified),\n            b'T' => Ok(StatusCode::TypeChanged),\n            b'A' => Ok(StatusCode::Added),\n            b'D' => Ok(StatusCode::Deleted),\n            b'R' => Ok(StatusCode::Renamed),\n            b'C' => Ok(StatusCode::Copied),\n            b' ' => Ok(StatusCode::Unmodified),\n            _ => anyhow::bail!(\"Invalid status code: {byte}\"),\n        }\n    }\n\n    fn to_summary(self) -> TrackedSummary {\n        match self {\n            StatusCode::Modified | StatusCode::TypeChanged => TrackedSummary {\n                modified: 1,\n                ..TrackedSummary::UNCHANGED\n            },\n            StatusCode::Added => TrackedSummary {\n                added: 1,\n                ..TrackedSummary::UNCHANGED\n            },\n            StatusCode::Deleted => TrackedSummary {\n                deleted: 1,\n                ..TrackedSummary::UNCHANGED\n            },\n            StatusCode::Renamed | StatusCode::Copied | StatusCode::Unmodified => {","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/git/src/status.rs#L217-L253","documentation":"FileStatus::from_bytes parses the two-character XY codes of `git status --porcelain=v1` output. StatusCode::from_byte accepts M, T, A, D, R, C and space; any other byte in an X or Y position raises this error, printing the byte value so you can see what git actually emitted.","triggerScenarios":"Parsing porcelain output whose XY codes contain an unexpected character: a wrapper or alias rewriting `git status` output, a git version emitting codes outside the documented set, or misaligned parsing after a preceding entry was mis-split (output captured without `-z` while the parser expects NUL delimiters, or vice versa).","commonSituations":"Machines with shell aliases/functions wrapping git status; unusual or very new git builds whose porcelain output differs; output captured with different flags than the parser assumes; embedded environments injecting banners into stdout.","solutions":["Reproduce with the exact command (`git status --porcelain=v1 --untracked-files=all --no-renames -z --`) and inspect the XY bytes of each line.","Remove aliases/wrappers (check `alias.status`, `core.pager`, GIT_* env) that could alter stdout.","Pin or upgrade git to a version with standard porcelain v1 output.","If standard git truly emits an undocumented byte, report it upstream with the raw line."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match stdout.parse::<GitStatus>() {\n    Err(e) if e.to_string().contains(\"Invalid status code\") => {\n        // nonstandard porcelain output: capture raw output, check git version and aliases, report\n    }\n    other => other?,\n}","preventionTips":["Pin a stock git binary; avoid aliases or wrappers that rewrite status output.","Capture and parse status with exactly the flags the parser expects (--porcelain=v1 -z).","Log the raw status bytes when parsing fails so the offending line is visible."],"tags":["git","status","porcelain","parsing"],"backgroundTag":"git-status-porcelain-parse-error","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}