{"record":{"id":"1b8dfe53e61fcfe5","repo":"paperclipai/paperclip","slug":"repo-requires-ref","errorCode":null,"errorMessage":"--repo requires --ref.","messagePattern":"--repo requires --ref\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/install.ts","lineNumber":131,"sourceCode":"    if (typeof parsed === \"string\") return parsed;\n  } catch {\n    if (EXACT_VERSION_PATTERN.test(trimmed)) return trimmed;\n  }\n  throw new Error(`npm returned an unexpected version response: ${trimmed}`);\n}\n\nexport async function resolvePublishedVersion(spec: string, runCommand: CommandRunner): Promise<string> {\n  const result = await runCommand(\n    \"npm\",\n    [\"view\", `paperclipai@${spec}`, \"version\", \"--json\", `--registry=${PUBLIC_NPM_REGISTRY}`],\n    { maxBuffer: 1024 * 1024 },\n  );\n  return parseResolvedVersion(result.stdout);\n}\n\nexport function resolveGitInstallRequest(options: InstallOptions): { repo: string; ref: string; pinned: boolean } | null {\n  if (!options.ref && !options.repo) return null;\n  if (!options.ref) throw new Error(\"--repo requires --ref.\");\n  if (options.canary || options.version) throw new Error(\"--ref cannot be combined with --canary or --version.\");\n  const repo = (options.repo ?? DEFAULT_GITHUB_REPO).trim();\n  const ref = options.ref.trim();\n  if (!/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$/.test(repo)) throw new Error(`--repo must be an owner/name GitHub repository, received '${repo}'.`);\n  if (!ref || ref.startsWith(\"-\") || /[\\0\\r\\n]/.test(ref)) throw new Error(`Invalid GitHub ref '${options.ref}'.`);\n  return { repo, ref, pinned: /^[0-9a-f]{7,40}$/i.test(ref) };\n}\n\nasync function runGitHubCurl(\n  args: string[],\n  runCommand: CommandRunner,\n  options?: Parameters<CommandRunner>[2],\n): Promise<{ stdout: string; stderr: string }> {\n  // 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);","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/install.ts#L113-L149","documentation":"Pairing guard in the git install request resolver: the caller supplied --repo (the GitHub owner/name source) without --ref (the commit/branch/tag to pin), so the install source is underspecified and the request is rejected before any clone or fetch.","triggerScenarios":"Thrown at cli/src/commands/install.ts:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass --ref together with --repo."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}