paperclipai/paperclip · error · ToolGatewayHttpError

gateway_issue_project_mismatch

gateway_issue_project_mismatch

Error message

Gateway issue must belong to the selected project

What it means

assertGatewayContext consistency check: the issue exists in the company but its projectId does not equal the projectId selected for the gateway. The 422 gateway_issue_project_mismatch prevents binding a gateway to an issue outside the chosen project scope; align the issue/project pair.

Solutions

  1. Choose an issue within the selected project, or omit the project filter.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/services/tool-gateway.ts:3386 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@3f1d897a7c (2026-09-18). Data as JSON: /api/errors/5d8797d3fdf969e2. Report an issue: GitHub.

Appendix: source

Thrown at server/src/services/tool-gateway.ts:6503

        .where(
          and(
            eq(issues.companyId, input.companyId),
            eq(issues.id, input.issueId),
          ),
        )
        .limit(1);
      if (!issue)
        throw new ToolGatewayHttpError(
          422,
          "Gateway issue must belong to the company",
          "gateway_issue_invalid",
        );
      if (
        input.projectId &&
        issue.projectId &&
        issue.projectId !== input.projectId
      ) {
        throw new ToolGatewayHttpError(
          422,
          "Gateway issue must belong to the selected project",
          "gateway_issue_project_mismatch",
        );
      }
    }
  }

  async function findGatewayForProtocolLocator(input: {
    gatewayId?: string | null;
    gatewayPublicId?: string | null;
  }) {
    if (input.gatewayId) {
      const [gateway] = await db
        .select()
        .from(toolMcpGateways)
        .where(eq(toolMcpGateways.id, input.gatewayId))
        .limit(1);

View on GitHub (pinned to 3f1d897a7c)