{"record":{"id":"11131daabd773e19","repo":"paperclipai/paperclip","slug":"refusing-to-use-unrecognized-install-store-paths","errorCode":null,"errorMessage":"Refusing to use unrecognized install store ${paths.cliRoot}.","messagePattern":"Refusing to use unrecognized install store (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"cli/src/install-store.ts","lineNumber":99,"sourceCode":"    manifestPath: path.join(cliRoot, \"install.json\"),\n    markerPath: path.join(cliRoot, \".managed-install\"),\n    lockPath: path.join(cliRoot, \".install.lock\"),\n    currentPath: path.join(cliRoot, \"current\"),\n    shimPath: path.join(homeDir, \".local\", \"bin\", \"paperclipai\"),\n  };\n}\n\nexport function initializeInstallStore(paths = resolveInstallStorePaths()): void {\n  ensurePrivateDirectory(paths.cliRoot);\n  ensurePrivateDirectory(paths.installsRoot);\n  try {\n    const markerStat = fs.lstatSync(paths.markerPath);\n    if (!markerStat.isFile() || markerStat.isSymbolicLink() || markerStat.nlink > 1) {\n      throw new Error(`Refusing to use unsafe install-store marker ${paths.markerPath}.`);\n    }\n    assertOwnedByCurrentUser(markerStat, paths.markerPath);\n    if (fs.readFileSync(paths.markerPath, \"utf8\") !== MANAGED_STORE_MARKER) {\n      throw new Error(`Refusing to use unrecognized install store ${paths.cliRoot}.`);\n    }\n  } catch (error) {\n    if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n    try {\n      fs.writeFileSync(paths.markerPath, MANAGED_STORE_MARKER, { mode: 0o600, flag: \"wx\" });\n    } catch (writeError) {\n      if (\n        (writeError as NodeJS.ErrnoException).code !== \"EEXIST\" ||\n        fs.readFileSync(paths.markerPath, \"utf8\") !== MANAGED_STORE_MARKER\n      ) {\n        throw writeError;\n      }\n    }\n  }\n}\n\nexport function assertManagedInstallStore(paths = resolveInstallStorePaths()): InstallManifest {\n  const cliStat = fs.lstatSync(paths.cliRoot);","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/install-store.ts#L81-L117","documentation":"Thrown by initializeInstallStore() when the marker file exists, is a valid regular file owned by the current user, but its contents do not equal the expected MANAGED_STORE_MARKER constant ('paperclipai managed install store v1\\n'). This means the directory is a real directory but is not a Paperclip-managed install store — overwriting it could destroy unrelated data.","triggerScenarios":"Called initializeInstallStore() on a cliRoot that contains a .managed-install file with unexpected contents (different marker string, empty, or garbage).","commonSituations":"1) The path ~/.paperclip/cli was reused for a different purpose or a different product that also uses a marker file. 2) A different Paperclip major version wrote a different marker string. 3) The marker was truncated or rewritten by an editor. 4) PAPERCLIP_HOME was pointed at a non-Paperclip directory.","solutions":["Verify the path is intended to be a Paperclip install store; if it holds unrelated data, move it aside or repoint PAPERCLIP_HOME.","If the directory is a stale or abandoned store, remove it entirely ('rm -rf ~/.paperclip/cli') and let the CLI initialize a fresh one.","If this is a version mismatch, consult the upgrade/migration notes for the Paperclip version in use.","Do not manually rewrite the marker unless you understand the store layout — prefer removing and re-initializing."],"exampleFix":"$ cat ~/.paperclip/cli/.managed-install\nsomething-else\n$ rm -rf ~/.paperclip/cli\n$ paperclipai install   # initializes fresh store with correct marker","handlingStrategy":"try-catch","validationCode":"import fs from \"node:fs\";\nimport { resolveInstallStorePaths, MANAGED_STORE_MARKER } from \"./install-store.js\";\n\nfunction isRecognizedStore(paths = resolveInstallStorePaths()): boolean {\n  try {\n    return fs.readFileSync(paths.markerPath, \"utf8\") === MANAGED_STORE_MARKER;\n  } catch { return false; }\n}","typeGuard":"import fs from \"node:fs\";\nimport { MANAGED_STORE_MARKER } from \"./install-store.js\";\n\nfunction hasValidMarker(markerPath: string): boolean {\n  try { return fs.readFileSync(markerPath, \"utf8\") === MANAGED_STORE_MARKER; }\n  catch { return false; }\n}","tryCatchPattern":"try {\n  initializeInstallStore(paths);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"unrecognized install store\")) {\n    console.error(`${paths.cliRoot} is not a Paperclip store. Remove it or set PAPERCLIP_HOME.`);\n    process.exit(1);\n  }\n  throw err;\n}","preventionTips":["Do not reuse ~/.paperclip/cli for non-Paperclip data.","When setting PAPERCLIP_HOME, point it at an empty or Paperclip-owned directory.","Avoid placing different products' state dirs in the same tree.","After major version upgrades, follow migration notes before reusing a store."],"tags":["install-store","security","marker","cli"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}