{"record":{"id":"c2cafee023c287d5","repo":"paperclipai/paperclip","slug":"npm-install-succeeded-but-adapter-reload-failed","errorCode":null,"errorMessage":"npm install succeeded but adapter reload failed.","messagePattern":"npm install succeeded but adapter reload failed\\.","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/src/routes/adapters.ts","lineNumber":682,"sourceCode":"    }\n\n    if (record.localPath) {\n      res.status(400).json({ error: \"Local-path adapters cannot be reinstalled. Use Reload instead.\" });\n      return;\n    }\n\n    try {\n      const pluginsDir = getAdapterPluginsDir();\n\n      logger.info({ type, packageName: record.packageName }, \"Reinstalling adapter package via npm\");\n\n      await execFileAsync(\"npm\", [\"install\", \"--no-save\", record.packageName], {\n        cwd: pluginsDir,\n        timeout: 120_000,\n      });\n\n      // Reload the freshly installed adapter\n      const newModule = await reloadExternalAdapter(type);\n      if (!newModule) {\n        res.status(500).json({ error: \"npm install succeeded but adapter reload failed.\" });\n        return;\n      }\n\n      unregisterServerAdapter(type);\n      registerWithSessionManagement(newModule);\n      configSchemaCache.delete(type);\n\n      // Sync store version from disk\n      let newVersion: string | undefined;\n      const updatedRecord = getAdapterPluginByType(type);\n      if (updatedRecord) {\n        newVersion = readAdapterPackageVersionFromDisk(updatedRecord);\n        if (newVersion) {\n          addAdapterPlugin({ ...updatedRecord, version: newVersion });\n        }\n      }","sourceCodeStart":664,"sourceCodeEnd":700,"githubUrl":"https://github.com/paperclipai/paperclip/blob/5716fe907e596ce73501408fc6efdb19fb61edf2/server/src/routes/adapters.ts#L664-L700","documentation":"Partial-failure in the reinstall route: the npm install of the adapter package succeeded, but re-importing the freshly installed module via reloadExternalAdapter failed, leaving the store record pointing at code that could not load. The route surfaces the inconsistency as an error.","triggerScenarios":"Thrown at server/src/routes/adapters.ts:624 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the adapter load error in the server logs, fix the adapter, and reload it manually."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5716fe907e596ce73501408fc6efdb19fb61edf2","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}