{"record":{"id":"e3ec86c82fa68a13","repo":"paperclipai/paperclip","slug":"choose-only-one-of-latest-canary-or-versio","errorCode":null,"errorMessage":"Choose only one of --latest, --canary, or --version.","messagePattern":"Choose only one of --latest, --canary, or --version\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/update.ts","lineNumber":119,"sourceCode":"  const bParts = b.prerelease.split(\".\");\n  for (let index = 0; index < Math.max(aParts.length, bParts.length); index += 1) {\n    const leftPart = aParts[index];\n    const rightPart = bParts[index];\n    if (leftPart === undefined) return -1;\n    if (rightPart === undefined) return 1;\n    if (leftPart === rightPart) continue;\n    const leftNumeric = /^\\d+$/.test(leftPart);\n    const rightNumeric = /^\\d+$/.test(rightPart);\n    if (leftNumeric && rightNumeric) return Math.sign(Number(leftPart) - Number(rightPart));\n    if (leftNumeric !== rightNumeric) return leftNumeric ? -1 : 1;\n    return leftPart < rightPart ? -1 : 1;\n  }\n  return 0;\n}\n\nexport function resolveUpdateRequest(manifest: InstallManifest | null, options: Pick<UpdateOptions, \"canary\" | \"latest\" | \"version\">): { spec: string; channel: InstallChannel; explicit: boolean } {\n  const selected = Number(Boolean(options.canary)) + Number(Boolean(options.latest)) + Number(Boolean(options.version));\n  if (selected > 1) throw new Error(\"Choose only one of --latest, --canary, or --version.\");\n  if (options.version) return { spec: options.version.trim(), channel: \"pinned\", explicit: true };\n  if (options.canary) return { spec: \"canary\", channel: \"canary\", explicit: true };\n  if (options.latest) return { spec: \"latest\", channel: \"latest\", explicit: true };\n  if (manifest?.channel === \"pinned\") return { spec: manifest.version, channel: \"pinned\", explicit: false };\n  const channel = manifest?.channel === \"canary\" ? \"canary\" : \"latest\";\n  return { spec: channel, channel, explicit: false };\n}\n\nexport function rollbackManagedInstall(paths = resolveInstallStorePaths()): InstallManifest {\n  const manifest = readInstallManifest(paths);\n  if (!manifest) throw new Error(\"No managed install was found to roll back.\");\n  const target = manifest.previous[0];\n  if (!target) throw new Error(\"No previous managed payload is available for rollback.\");\n  if (!fs.existsSync(target.payloadPath)) throw new Error(`Previous payload is missing: ${target.payloadPath}`);\n  const current: InstallRecord = { source: manifest.source, version: manifest.version, channel: manifest.channel, payloadPath: manifest.payloadPath, repo: manifest.repo, ref: manifest.ref, sha: manifest.sha, installedAt: manifest.installedAt };\n  const next: InstallManifest = { schemaVersion: manifest.schemaVersion, ...target, previous: [current, ...manifest.previous.slice(1)].slice(0, 2) };\n  const oldTarget = fs.readlinkSync(paths.currentPath);\n  flipCurrentAtomic(target.payloadPath, paths);","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/update.ts#L101-L137","documentation":"resolveUpdateRequest counted more than one of --latest/--canary/--version; exactly one channel selector may be given for an update.","triggerScenarios":"Thrown at cli/src/commands/update.ts:119 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass only one of --latest, --canary, or --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-23T08:17:48.524Z"}