{"record":{"id":"cfbf7c878d62537e","repo":"paperclipai/paperclip","slug":"failed-to-reload-adapter-message","errorCode":null,"errorMessage":"Failed to reload adapter: ${message}","messagePattern":"Failed to reload adapter: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/src/routes/adapters.ts","lineNumber":636,"sourceCode":"      unregisterServerAdapter(type);\n      registerWithSessionManagement(newModule);\n      configSchemaCache.delete(type);\n\n      // Sync store.version from package.json (store may be missing version for local installs).\n      const record = getAdapterPluginByType(type);\n      let newVersion: string | undefined;\n      if (record) {\n        newVersion = readAdapterPackageVersionFromDisk(record);\n        if (newVersion) {\n          addAdapterPlugin({ ...record, version: newVersion });\n        }\n      }\n\n      logger.info({ type, version: newVersion }, \"External adapter reloaded at runtime\");\n\n      res.json({ type, version: newVersion, reloaded: true });\n    } catch (err) {\n      const message = err instanceof Error ? err.message : String(err);\n      logger.error({ err, type }, \"Failed to reload external adapter\");\n      res.status(500).json({ error: `Failed to reload adapter: ${message}` });\n    }\n  });\n\n  // ── POST /api/adapters/:type/reinstall ──────────────────────────────────\n  // Reinstall an npm-sourced external adapter (pulls latest from registry).\n  // Local-path adapters cannot be reinstalled — use Reload instead.\n  //\n  // This is a convenience shortcut for remove + install with the same\n  // package name, but without the risk of losing the store record.\n  router.post(\"/adapters/:type/reinstall\", async (req, res) => {\n    assertInstanceAdmin(req);\n    assertAdapterCodeInstallAllowed();\n    assertAdapterManagementVisible();\n\n    const type = req.params.type;\n","sourceCodeStart":618,"sourceCodeEnd":654,"githubUrl":"https://github.com/paperclipai/paperclip/blob/5716fe907e596ce73501408fc6efdb19fb61edf2/server/src/routes/adapters.ts#L618-L654","documentation":"Wrapped failure in the reload route's catch block: re-importing/re-registering the external adapter module threw (bad module code, missing export, filesystem error), so the runtime reload is aborted and the underlying message is returned with a 500.","triggerScenarios":"Thrown at server/src/routes/adapters.ts:579 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the failure message, fix the adapter code or installation, and reload again."],"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"}