{"record":{"id":"bbc02ba0a1ac5338","repo":"saadeghi/daisyui","slug":"malformed-git-diff-entry-for-status-status","errorCode":null,"errorMessage":"Malformed git diff entry for status ${status}","messagePattern":"Malformed git diff entry for status (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailwind-play-share/pr-preview.mjs","lineNumber":349,"sourceCode":"  }\n}\n\nexport function parseNameStatus(output) {\n  const tokens = output.split(\"\\0\")\n  if (tokens.at(-1) === \"\") tokens.pop()\n  const changes = []\n\n  for (let index = 0; index < tokens.length;) {\n    const status = tokens[index]\n    index += 1\n    if (!status) continue\n\n    const kind = status[0]\n    if (kind === \"R\" || kind === \"C\") {\n      const oldPath = tokens[index]\n      const headPath = tokens[index + 1]\n      index += 2\n      if (!oldPath || !headPath) throw new Error(`Malformed git diff entry for status ${status}`)\n      changes.push({ headPath, kind, oldPath, status })\n      continue\n    }\n\n    const filePath = tokens[index]\n    index += 1\n    if (!filePath) throw new Error(`Malformed git diff entry for status ${status}`)\n    changes.push({\n      headPath: kind === \"D\" ? undefined : filePath,\n      kind,\n      oldPath: kind === \"D\" ? filePath : undefined,\n      status,\n    })\n  }\n\n  return changes\n}\n","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/saadeghi/daisyui/blob/42b09e637e09467aa54a813a5aea53c1179aec75/packages/tailwind-play-share/pr-preview.mjs#L331-L367","documentation":"Thrown by parseNameStatus when a git diff --name-status entry has a status beginning with R (rename) or C (copy) but the two following NUL-separated tokens (old path, head path) are missing. These status kinds require two path tokens; the guard detects a truncated/empty token stream.","triggerScenarios":"parseNameStatus reads status = tokens[index], sees kind R/C, then tokens[index] or tokens[index+1] is undefined/empty after incrementing, so `!oldPath || !headPath` is true.","commonSituations":"Corrupted or unexpectedly formatted `git diff -z --name-status` output, a git version emitting a status line the parser does not expect (e.g. an unmerged status), or manual truncation of the diff output. Should not occur with well-formed git output.","solutions":["Re-run; if it persists, capture the raw `git diff --name-status --find-renames -z BASE HEAD -- packages/daisyui/src/components` output and inspect it.","Ensure a standard git version is on PATH.","Verify both SHAs resolve cleanly (see error 53).","Report upstream with the raw diff tokens if git output is well-formed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { execSync } from \"node:child_process\"\nfunction assertDiffWellFormed(baseSha, headSha) {\n  const out = execSync(`git diff --name-status --find-renames -z ${baseSha} ${headSha} -- packages/daisyui/src/components`, { encoding: \"utf8\" })\n  const tokens = out.split(\"\\0\")\n  for (let i = 0; i < tokens.length;) {\n    const s = tokens[i++]; if (!s) continue\n    if (s[0] === \"R\" || s[0] === \"C\") { if (!tokens[i] || !tokens[i + 1]) throw new Error(`Malformed diff at ${s}`); i += 2 } else { if (!tokens[i]) throw new Error(`Malformed diff at ${s}`); i++ }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  inputs = buildPreviewInputs(baseSha, headSha)\n} catch (error) {\n  if (/Malformed git diff entry for status/.test(error.message)) {\n  // inspect raw `git diff -z --name-status` output; likely corrupted capture\n  }\n  throw error\n}","preventionTips":["Use a standard git version on PATH.","Avoid truncating captured git output in CI wrappers.","Validate the -z token stream shape before planning."],"tags":["git","diff-parsing","internal"],"backgroundTag":null,"analyzedSha":"42b09e637e09467aa54a813a5aea53c1179aec75","analyzedAt":"2026-08-13T04:10:09.555Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}