{"record":{"id":"d699aae35cb4b0dd","repo":"saadeghi/daisyui","slug":"git-args-0-failed-details","errorCode":null,"errorMessage":"git ${args[0]} failed: ${details}","messagePattern":"git (.+?) failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailwind-play-share/pr-preview.mjs","lineNumber":101,"sourceCode":"      default:\n        throw new Error(`Unknown option: ${argument}`)\n    }\n  }\n\n  return options\n}\n\nfunction git(args) {\n  try {\n    return execFileSync(\"git\", args, {\n      cwd: repositoryRoot,\n      encoding: \"utf8\",\n      maxBuffer: 32 * 1024 * 1024,\n      stdio: [\"ignore\", \"pipe\", \"pipe\"],\n    })\n  } catch (error) {\n    const details = error.stderr?.trim() || error.message\n    throw new Error(`git ${args[0]} failed: ${details}`)\n  }\n}\n\nfunction componentNameFromPath(filePath) {\n  return filePath.match(componentPathPattern)?.[1]\n}\n\nfunction isCssWhitespace(character) {\n  return (\n    character === \" \" ||\n    character === \"\\n\" ||\n    character === \"\\r\" ||\n    character === \"\\t\" ||\n    character === \"\\f\"\n  )\n}\n\nfunction isCssHexDigit(character) {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/saadeghi/daisyui/blob/42b09e637e09467aa54a813a5aea53c1179aec75/packages/tailwind-play-share/pr-preview.mjs#L83-L119","documentation":"Thrown by the git() helper in pr-preview.mjs when execFileSync(\"git\", args, ...) exited non-zero. The error message embeds the trimmed git stderr (or, if stderr is empty, the underlying error.message). The args[0] names which git subcommand failed.","triggerScenarios":"Any git invocation inside buildPreviewInputs/listDocsPages/readFileAtRevision fails: `git diff`, `git ls-tree`, or `git show`. Triggers when the commit SHAs are missing/unknown, the pathspec matches nothing, or git is absent.","commonSituations":"Passing a base/head SHA that does not exist in the local clone (common in shallow CI checkouts), running outside a git repo, git not on PATH, or a shallow clone missing the base commit depth.","solutions":["Ensure both SHAs exist locally: `git cat-file -e ${sha}^{commit}`.","Run inside the repository root with git on PATH.","For shallow CI clones, deepen or fetch the base: `git fetch --depth=100 origin ${baseSha}`.","Read the embedded git stderr - it states the exact git error."],"exampleFix":"# before (shallow clone missing base)\npr-preview --base-sha $BASE --head-sha $HEAD --output out.json\n\n# after\ngit fetch --unshallow  # or: git fetch origin $BASE\ngit cat-file -e ${BASE}^{commit} && git cat-file -e ${HEAD}^{commit}\npr-preview --base-sha $BASE --head-sha $HEAD --output out.json","handlingStrategy":"try-catch","validationCode":"import { execSync } from \"node:child_process\"\nfunction assertCommitsExist(...shas) {\n  for (const sha of shas) {\n    execSync(`git cat-file -e ${sha}^{commit}`, { stdio: \"ignore\" })\n  }\n}\nassertCommitsExist(baseSha, headSha)","typeGuard":null,"tryCatchPattern":"try {\n  await generatePrPreview({ baseSha, headSha, output })\n} catch (error) {\n  if (/^git (diff|ls-tree|show) failed:/.test(error.message)) {\n  // fetch missing commits, deepen clone, then retry\n  }\n  throw error\n}","preventionTips":["Fetch both SHAs into the clone before running (unshallow or depth-fetch).","Run inside the repo root with git on PATH.","Validate SHAs with `git cat-file -e <sha>^{commit}` first."],"tags":["git","subprocess","commits","ci"],"backgroundTag":null,"analyzedSha":"42b09e637e09467aa54a813a5aea53c1179aec75","analyzedAt":"2026-08-13T04:10:09.555Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}