{"record":{"id":"3c4c39a80787cc62","repo":"paperclipai/paperclip","slug":"scopeerror","errorCode":null,"errorMessage":"scopeError","messagePattern":"scopeError","errorType":"http","errorClass":null,"httpStatus":403,"severity":"error","filePath":"server/src/routes/plugins.ts","lineNumber":1049,"sourceCode":"      return;\n    }\n\n    if (!runContext || typeof runContext !== \"object\") {\n      res.status(400).json({ error: '\"runContext\" is required and must be an object' });\n      return;\n    }\n\n    if (!runContext.agentId || !runContext.runId || !runContext.companyId || !runContext.projectId) {\n      res.status(400).json({\n        error: '\"runContext\" must include agentId, runId, companyId, and projectId',\n      });\n      return;\n    }\n\n    assertCompanyAccess(req, runContext.companyId);\n    const scopeError = await validateToolRunContextScope(runContext);\n    if (scopeError) {\n      res.status(403).json({ error: scopeError });\n      return;\n    }\n\n    if (req.actor.type === \"agent\" && toolGatewayDeps) {\n      try {\n        const result = await toolGatewayDeps.toolGateway.executePluginTool({\n          actor: {\n            type: \"agent\",\n            agentId: req.actor.agentId,\n            companyId: req.actor.companyId,\n            runId: req.actor.runId ?? null,\n          },\n          tool,\n          parameters: parameters ?? {},\n          runContext,\n        });\n        res.json(result);\n      } catch (err) {","sourceCodeStart":1031,"sourceCodeEnd":1067,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/routes/plugins.ts#L1031-L1067","documentation":"validateToolRunContextScope found the run context's agent/run/company/project binding does not match the actor's authenticated scope; the tool gateway refuses to execute outside the validated scope and the reason is surfaced as scopeError.","triggerScenarios":"Thrown at server/src/routes/plugins.ts:1034 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the request so it satisfies the condition stated in the error message, then retry; see the throwing line in the named file for the exact check."],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}