{"record":{"id":"aabb5ff211e477e2","repo":"paperclipai/paperclip","slug":"refusing-to-use-non-directory-install-store-path","errorCode":null,"errorMessage":"Refusing to use non-directory install-store path ${directoryPath}.","messagePattern":"Refusing to use non-directory install-store path (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/install-store.ts","lineNumber":45,"sourceCode":"  previous: InstallRecord[];\n};\n\nexport type InstallStorePaths = {\n  paperclipHome: string;\n  cliRoot: string;\n  installsRoot: string;\n  manifestPath: string;\n  markerPath: string;\n  lockPath: string;\n  currentPath: string;\n  shimPath: string;\n};\n\nfunction ensurePrivateDirectory(directoryPath: string): void {\n  fs.mkdirSync(directoryPath, { recursive: true, mode: 0o700 });\n  const stat = fs.lstatSync(directoryPath);\n  if (!stat.isDirectory() || stat.isSymbolicLink()) {\n    throw new Error(`Refusing to use non-directory install-store path ${directoryPath}.`);\n  }\n  fs.chmodSync(directoryPath, 0o700);\n}\n\nfunction assertOwnedByCurrentUser(stat: fs.Stats, targetPath: string): void {\n  const getuid = process.getuid;\n  if (typeof getuid === \"function\" && stat.uid !== getuid()) {\n    throw new Error(`Refusing to modify path not owned by the current user: ${targetPath}.`);\n  }\n}\n\nfunction writeFileAtomic(filePath: string, contents: string, mode: number): void {\n  const temporaryPath = path.join(\n    path.dirname(filePath),\n    `.${path.basename(filePath)}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`,\n  );\n  try {\n    fs.writeFileSync(temporaryPath, contents, { mode, flag: \"wx\" });","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/install-store.ts#L27-L63","documentation":"ensurePrivateDirectory created/inspected the install-store directory and found a non-directory or symlink at the path; the guard refuses to use unsafe store locations.","triggerScenarios":"Thrown at cli/src/install-store.ts:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Point the install-store path at a directory, not a file.","Remove the non-directory path at ${directoryPath} and retry."],"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"}