{"record":{"id":"b2952410e3f9bff5","repo":"paperclipai/paperclip","slug":"github-returned-an-invalid-response-while-resolvin","errorCode":null,"errorMessage":"GitHub returned an invalid response while resolving ${repo}@${ref}.","messagePattern":"GitHub returned an invalid response while resolving (.+?)@(.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/install.ts","lineNumber":163,"sourceCode":"  // Anonymous GitHub requests are rate-limited per source IP (CI runners and\n  // corporate NAT exhaust the shared quota); honor an ambient token when present.\n  // The token travels via a curl --config file so it never appears in process args.\n  const token = process.env.GH_TOKEN ?? process.env.GITHUB_TOKEN;\n  if (!token) return runCommand(\"curl\", args, options);\n  const configDir = fs.mkdtempSync(path.join(os.tmpdir(), \"paperclipai-gh-\"));\n  const configFile = path.join(configDir, \"headers\");\n  try {\n    fs.writeFileSync(configFile, `header = \"Authorization: Bearer ${token}\"\\n`, { mode: 0o600 });\n    return await runCommand(\"curl\", [\"--config\", configFile, ...args], options);\n  } finally {\n    fs.rmSync(configDir, { recursive: true, force: true });\n  }\n}\n\nexport async function resolveGitHubRef(repo: string, ref: string, runCommand: CommandRunner): Promise<string> {\n  const result = await runGitHubCurl([\"--fail\", \"--silent\", \"--show-error\", \"--location\", \"--header\", \"Accept: application/vnd.github+json\", \"--header\", \"User-Agent: paperclipai-install\", `https://api.github.com/repos/${repo}/commits/${encodeURIComponent(ref)}`], runCommand, { maxBuffer: 4 * 1024 * 1024 });\n  let sha: unknown;\n  try { sha = (JSON.parse(result.stdout) as { sha?: unknown }).sha; } catch { throw new Error(`GitHub returned an invalid response while resolving ${repo}@${ref}.`); }\n  if (typeof sha !== \"string\" || !/^[0-9a-f]{40}$/i.test(sha)) throw new Error(`GitHub did not return a full commit SHA for ${repo}@${ref}.`);\n  return sha.toLowerCase();\n}\n\nfunction payloadEntrypoint(payloadPath: string): string {\n  return path.join(payloadPath, \"node_modules\", \"paperclipai\", \"dist\", \"index.js\");\n}\n\nexport async function smokePayload(payloadPath: string, expectedVersion: string, runCommand: CommandRunner): Promise<void> {\n  const entrypoint = payloadEntrypoint(payloadPath);\n  if (!fs.existsSync(entrypoint)) throw new Error(`Installed package is missing its CLI entrypoint: ${entrypoint}`);\n  const result = await runCommand(process.execPath, [entrypoint, \"--version\"], { maxBuffer: 1024 * 1024 });\n  const reportedVersion = result.stdout.trim().split(/\\s+/)[0];\n  if (reportedVersion !== expectedVersion) {\n    throw new Error(`Installed CLI smoke check reported ${reportedVersion || \"no version\"}; expected ${expectedVersion}.`);\n  }\n}\n","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/install.ts#L145-L181","documentation":"Error \"GitHub returned an invalid response while resolving ${repo}@${ref}.\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at cli/src/commands/install.ts:163 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}