{"record":{"id":"534f56c4cc8de098","repo":"paperclipai/paperclip","slug":"ref-cannot-be-combined-with-canary-or-versio","errorCode":null,"errorMessage":"--ref cannot be combined with --canary or --version.","messagePattern":"--ref cannot be combined with --canary or --version\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/install.ts","lineNumber":132,"sourceCode":"  } 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);\n  const configDir = fs.mkdtempSync(path.join(os.tmpdir(), \"paperclipai-gh-\"));","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/install.ts#L114-L150","documentation":"Channel-conflict guard in the git install request resolver: a git-ref install is its own source/channel, so combining --ref with the npm-channel flags --canary or --version is rejected before any download.","triggerScenarios":"Thrown at cli/src/commands/install.ts:132 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use --ref alone (with --repo); drop --canary and --version."],"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-14T05:17:10.506Z"}