{"record":{"id":"44e0adb9d0442e38","repo":"paperclipai/paperclip","slug":"err-instanceof-error-err-message-string-err","errorCode":null,"errorMessage":"err instanceof Error ? err.message : String(err)","messagePattern":"err instanceof Error \\? err\\.message : String\\(err\\)","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/src/routes/plugins.ts","lineNumber":2660,"sourceCode":"    const { pluginId, jobId } = req.params;\n    const plugin = await resolvePlugin(registry, pluginId);\n    if (!plugin) {\n      res.status(404).json({ error: \"Plugin not found\" });\n      return;\n    }\n\n    const job = await jobDeps.jobStore.getJobByIdForPlugin(plugin.id, jobId);\n    if (!job) {\n      res.status(404).json({ error: \"Job not found\" });\n      return;\n    }\n\n    try {\n      const result = await jobDeps.scheduler.triggerJob(jobId, \"manual\");\n      res.json(result);\n    } catch (err) {\n      const message = err instanceof Error ? err.message : String(err);\n      res.status(400).json({ error: message });\n    }\n  });\n\n  // ===========================================================================\n  // Webhook ingestion route\n  // ===========================================================================\n\n  /**\n   * POST /api/plugins/:pluginId/webhooks/:endpointKey\n   *\n   * Receive an inbound webhook delivery for a plugin.\n   *\n   * This route is called by external systems (e.g. GitHub, Linear, Stripe) to\n   * deliver webhook payloads to a plugin. The host validates that:\n   * 1. The plugin exists and is in 'ready' state\n   * 2. The plugin declares the `webhooks.receive` capability\n   * 3. The `endpointKey` matches a declared webhook in the manifest\n   *","sourceCodeStart":2642,"sourceCodeEnd":2678,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/routes/plugins.ts#L2642-L2678","documentation":"400 from manual job trigger (POST job trigger route). Not a message constant: the handler stringifies an arbitrary thrown error (err.message or String(err)) and returns it with 400 when scheduler.triggerJob fails for the requested job.","triggerScenarios":"Thrown at server/src/routes/plugins.ts:2638 when the library encounters an invalid state.","commonSituations":"Occurs when a plugin job execution fails and the route surfaces the caught error message. Common causes: misconfigured plugin job, missing credentials, or a bug in the plugin's job handler.","solutions":["Inspect the underlying error message returned in the response; it contains the actual failure reason from the job run.","Check server logs around the timestamp of the failed job for the full stack trace.","Verify the plugin job handler is not throwing and that required configuration and credentials are set."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}