{"record":{"id":"0274c18e84bb8039","repo":"paperclipai/paperclip","slug":"no-managed-install-was-found-to-roll-back","errorCode":null,"errorMessage":"No managed install was found to roll back.","messagePattern":"No managed install was found to roll back\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/update.ts","lineNumber":130,"sourceCode":"    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);\n  try { writeInstallManifestAtomic(next, paths); } catch (error) { flipCurrentAtomic(path.resolve(paths.cliRoot, oldTarget), paths); throw error; }\n  return next;\n}\n\nasync function defaultConfirm(message: string): Promise<boolean> {\n  if (!process.stdin.isTTY || !process.stdout.isTTY) return false;\n  const answer = await p.confirm({ message, initialValue: false });\n  return !p.isCancel(answer) && answer === true;\n}\nfunction emit(options: UpdateOptions, value: Record<string, unknown>, message: string): void { if (options.json) console.log(JSON.stringify(value, null, 2)); else console.log(message); }\n","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/update.ts#L112-L148","documentation":"Thrown by rollbackManagedInstall when readInstallManifest returns null — i.e. there is no install manifest file in the managed install store (the store directory is missing or never had manifest.json written). Without a manifest there is no record of the current payload, so rollback has nothing to operate on. This is distinct from having a manifest but no previous entry.","triggerScenarios":"Calling `paperclipai update --rollback`, or rollbackManagedInstall directly, on a system where the managed install store does not exist or its manifest.json was deleted/corrupted. detectInstallMode may still report 'managed' if the symlink resolves, but the manifest read fails.","commonSituations":"Manifest file manually deleted. Store directory partially wiped (only the payload survives). First-time install that never completed manifest write. Running rollback after the store was moved to a new PAPERCLIP_HOME without copying the manifest.","solutions":["Reinstall a managed CLI with `paperclipai install` to regenerate the manifest and store, then updates/rollbacks will work again.","Restore the missing manifest.json from backup into the managed install store root.","If the store is unrecoverable, remove the broken store directory entirely and run `paperclipai install` clean."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import fs from 'node:fs';\nimport { resolveInstallStorePaths, readInstallManifest } from '../install-store.js';\nfunction hasManagedManifest(): boolean {\n  const paths = resolveInstallStorePaths();\n  return fs.existsSync(paths.cliRoot) && readInstallManifest(paths) !== null;\n}\n// if (!hasManagedManifest()) { /* reinstall before rollback */ }","typeGuard":null,"tryCatchPattern":"try {\n  rollbackManagedInstall(paths);\n} catch (error) {\n  if (error instanceof Error && error.message === 'No managed install was found to roll back.') {\n    // nothing to roll back — reinstall a managed payload instead\n    await installCommand(/* ... */);\n  } else throw error;\n}","preventionTips":["Never delete manifest.json from the managed install store; back it up instead.","Verify the store is intact before attempting rollback.","Use `paperclipai install` rather than manual file moves to keep the manifest consistent."],"tags":["rollback","managed-install","update"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}