{"record":{"id":"a4825140aee9a0df","repo":"paperclipai/paperclip","slug":"refusing-to-install-into-unsafe-payload-root-sou","errorCode":null,"errorMessage":"Refusing to install into unsafe payload root ${sourceRoot}.","messagePattern":"Refusing to install into unsafe payload root (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/install.ts","lineNumber":196,"sourceCode":"    throw new Error(`Installed CLI smoke check reported ${reportedVersion || \"no version\"}; expected ${expectedVersion}.`);\n  }\n}\n\nexport async function installNpmPayload(\n  version: string,\n  runCommand: CommandRunner,\n  paths = resolveInstallStorePaths(),\n): Promise<{ payloadPath: string; reused: boolean }> {\n  const payloadPath = payloadPathFor(paths, \"npm\", version);\n  if (fs.existsSync(payloadPath)) {\n    await smokePayload(payloadPath, version, runCommand);\n    return { payloadPath, reused: true };\n  }\n  const sourceRoot = path.dirname(payloadPath);\n  fs.mkdirSync(sourceRoot, { recursive: true, mode: 0o700 });\n  const sourceStat = fs.lstatSync(sourceRoot);\n  if (!sourceStat.isDirectory() || sourceStat.isSymbolicLink()) {\n    throw new Error(`Refusing to install into unsafe payload root ${sourceRoot}.`);\n  }\n  fs.chmodSync(paths.cliRoot, 0o700);\n  fs.chmodSync(paths.installsRoot, 0o700);\n  fs.chmodSync(sourceRoot, 0o700);\n  const stagingPath = path.join(sourceRoot, `.${version}.tmp-${process.pid}-${Date.now()}`);\n  const npmUserConfigPath = path.join(sourceRoot, `.npmrc-${process.pid}-${Date.now()}`);\n  fs.rmSync(stagingPath, { recursive: true, force: true });\n  try {\n    fs.writeFileSync(\n      npmUserConfigPath,\n      `registry=${PUBLIC_NPM_REGISTRY}\\n@paperclipai:registry=${PUBLIC_NPM_REGISTRY}\\n`,\n      { mode: 0o600 },\n    );\n    await runCommand(\n      \"npm\",\n      [\n        \"install\",\n        \"--prefix\",","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/install.ts#L178-L214","documentation":"Error \"Refusing to install into unsafe payload root ${sourceRoot}.\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at cli/src/commands/install.ts:196 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}