{"record":{"id":"8789580bfe54c9d3","repo":"paperclipai/paperclip","slug":"package-root-not-found-for-plugin-plugin-plugin","errorCode":null,"errorMessage":"Package root not found for plugin \"${plugin.pluginKey}\"","messagePattern":"Package root not found for plugin \"(.+?)\"","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/src/services/plugin-loader.ts","lineNumber":2581,"sourceCode":"\nfunction resolvePluginPackageRoot(\n  plugin: PluginRecord & { packagePath?: string | null },\n  localPluginDir: string,\n): string {\n  if (plugin.packagePath && existsSync(plugin.packagePath)) {\n    return path.resolve(plugin.packagePath);\n  }\n\n  const packageName = plugin.packageName;\n  const packageDir = packageName.startsWith(\"@\")\n    ? path.join(localPluginDir, \"node_modules\", ...packageName.split(\"/\"))\n    : path.join(localPluginDir, \"node_modules\", packageName);\n  if (existsSync(packageDir)) return packageDir;\n\n  const directDir = path.join(localPluginDir, packageName);\n  if (existsSync(directDir)) return directDir;\n\n  throw new Error(`Package root not found for plugin \"${plugin.pluginKey}\"`);\n}\n\nfunction resolveManagedInstallPackageDir(localPluginDir: string, packageName: string): string {\n  if (packageName.startsWith(\"@\")) {\n    return path.join(localPluginDir, \"node_modules\", ...packageName.split(\"/\"));\n  }\n  return path.join(localPluginDir, \"node_modules\", packageName);\n}\n\nfunction isPathInsideDir(candidatePath: string, parentDir: string): boolean {\n  const resolvedCandidate = path.resolve(candidatePath);\n  const resolvedParent = path.resolve(parentDir);\n  const relative = path.relative(resolvedParent, resolvedCandidate);\n  return relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n}\n","sourceCodeStart":2563,"sourceCodeEnd":2597,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/services/plugin-loader.ts#L2563-L2597","documentation":"Root resolution guard in resolvePluginPackageRoot: neither the recorded packagePath nor the node_modules layout nor the direct localPluginDir/packageName location exists. The plugin's files were removed or never installed; the missing package directory is at fault.","triggerScenarios":"Thrown at server/src/services/plugin-loader.ts:2581 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The plugin package root could not be resolved. Reinstall the plugin or verify its install directory was not moved or deleted."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}