{"record":{"id":"753e532c60288fc9","repo":"paperclipai/paperclip","slug":"refusing-to-modify-path-not-owned-by-the-current-u","errorCode":null,"errorMessage":"Refusing to modify path not owned by the current user: ${targetPath}.","messagePattern":"Refusing to modify path not owned by the current user: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/install-store.ts","lineNumber":53,"sourceCode":"  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\" });\n    fs.renameSync(temporaryPath, filePath);\n  } finally {\n    fs.rmSync(temporaryPath, { force: true });\n  }\n}\n\nexport function resolveInstallStorePaths(options: {\n  paperclipHome?: string;","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/install-store.ts#L35-L71","documentation":"assertOwnedByCurrentUser compared the filesystem owner uid of a store path with the process uid and they differ; the guard refuses to modify paths not owned by the current user.","triggerScenarios":"Thrown at cli/src/install-store.ts:53 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Change ownership of ${targetPath} to the current user (e.g. `sudo chown $USER ${targetPath}`).","Choose an install path owned by the current user."],"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"}