{"record":{"id":"d3e1f28d2af14d25","repo":"paperclipai/paperclip","slug":"npm-install-failed-message","errorCode":null,"errorMessage":"npm install failed: ${message}","messagePattern":"npm install failed: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/src/routes/adapters.ts","lineNumber":419,"sourceCode":"      addAdapterPlugin(record);\n\n      logger.info(\n        { type: adapterModule.type, packageName: canonicalName },\n        \"External adapter installed and registered\",\n      );\n\n      res.status(201).json({\n        type: adapterModule.type,\n        packageName: canonicalName,\n        version: installedVersion ?? explicitVersion,\n        installedAt: record.installedAt,\n        requiresRestart: isReinstall,\n      });\n    } catch (err) {\n      const message = err instanceof Error ? err.message : String(err);\n      logger.error({ err, packageName }, \"Failed to install external adapter\");\n\n      // Distinguish npm errors from load errors\n      if (message.includes(\"npm\") || message.includes(\"ERR!\")) {\n        res.status(500).json({ error: `npm install failed: ${message}` });\n      } else {\n        res.status(500).json({ error: `Failed to install adapter: ${message}` });\n      }\n    }\n  });\n\n  router.get(\"/adapters/:type\", async (req, res) => {\n    assertBoardOrgAccess(req);\n\n    const adapterType = req.params.type;\n    const adapter = findServerAdapter(adapterType);\n    if (!adapter) {\n      res.status(404).json({ error: `Adapter \"${adapterType}\" is not registered.` });\n      return;\n    }\n","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/paperclipai/paperclip/blob/5716fe907e596ce73501408fc6efdb19fb61edf2/server/src/routes/adapters.ts#L401-L437","documentation":"Wrapped failure in the adapter install route's catch block: the underlying install error message contains npm/ERR! markers, identifying it as an npm registry/installer failure (network, auth, missing package) rather than a module-load failure; it is re-surfaced as a 500 with the npm context preserved.","triggerScenarios":"Thrown at server/src/routes/adapters.ts:368 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the npm error message, fix the package name/version or network issue, and retry the install."],"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-14T00:17:10.932Z"}