{"record":{"id":"6138b0623f9e0fe0","repo":"paperclipai/paperclip","slug":"refusing-to-remove-unsafe-install-store-path-pat","errorCode":null,"errorMessage":"Refusing to remove unsafe install-store path ${paths.cliRoot}.","messagePattern":"Refusing to remove unsafe install-store path (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/install-store.ts","lineNumber":119,"sourceCode":"  } 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);\n  if (!cliStat.isDirectory() || cliStat.isSymbolicLink()) {\n    throw new Error(`Refusing to remove unsafe install-store path ${paths.cliRoot}.`);\n  }\n  assertOwnedByCurrentUser(cliStat, paths.cliRoot);\n  let markerStat: fs.Stats;\n  try {\n    markerStat = fs.lstatSync(paths.markerPath);\n  } catch (error) {\n    if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n      throw new Error(`Refusing to remove unverified install store ${paths.cliRoot}.`);\n    }\n    throw error;\n  }\n  if (!markerStat.isFile() || markerStat.isSymbolicLink() || markerStat.nlink > 1) {\n    throw new Error(`Refusing to remove unverified install store ${paths.cliRoot}.`);\n  }\n  assertOwnedByCurrentUser(markerStat, paths.markerPath);\n  if (fs.readFileSync(paths.markerPath, \"utf8\") !== MANAGED_STORE_MARKER) {\n    throw new Error(`Refusing to remove unverified install store ${paths.cliRoot}.`);\n  }","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/install-store.ts#L101-L137","documentation":"assertManagedInstallStore lstat'ed the install-store root before removal and found it is not a plain directory (symlink or other); the guard refuses unsafe rm targets.","triggerScenarios":"Thrown at cli/src/install-store.ts:119 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not remove unsafe paths; verify ${paths.cliRoot} is a genuine install store first.","Choose a different, verified install-store path to remove."],"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"}