paperclipai/paperclip · error

scopeError

Error message

scopeError

What it means

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.

Solutions

  1. 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.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/routes/plugins.ts:1034 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@a7e689b3c3 (2026-08-18). Data as JSON: /api/errors/3c4c39a80787cc62. Report an issue: GitHub.

Appendix: source

Thrown at server/src/routes/plugins.ts:1049

      return;
    }

    if (!runContext || typeof runContext !== "object") {
      res.status(400).json({ error: '"runContext" is required and must be an object' });
      return;
    }

    if (!runContext.agentId || !runContext.runId || !runContext.companyId || !runContext.projectId) {
      res.status(400).json({
        error: '"runContext" must include agentId, runId, companyId, and projectId',
      });
      return;
    }

    assertCompanyAccess(req, runContext.companyId);
    const scopeError = await validateToolRunContextScope(runContext);
    if (scopeError) {
      res.status(403).json({ error: scopeError });
      return;
    }

    if (req.actor.type === "agent" && toolGatewayDeps) {
      try {
        const result = await toolGatewayDeps.toolGateway.executePluginTool({
          actor: {
            type: "agent",
            agentId: req.actor.agentId,
            companyId: req.actor.companyId,
            runId: req.actor.runId ?? null,
          },
          tool,
          parameters: parameters ?? {},
          runContext,
        });
        res.json(result);
      } catch (err) {

View on GitHub (pinned to a7e689b3c3)