paperclipai/paperclip · error · ToolGatewayHttpError

gateway_issue_invalid

gateway_issue_invalid

Error message

Gateway issue must belong to the company

What it means

assertGatewayContext validation: the issueId supplied for the gateway does not match any issue in the requesting company. The 422 gateway_issue_invalid comes from the company-scoped issues lookup and covers deleted, foreign-company, or malformed issue ids.

Solutions

  1. Select an issue that belongs to the same company as the gateway request.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/services/tool-gateway.ts:3384 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/31e778f132f958fa. Report an issue: GitHub.

Appendix: source

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

        throw new ToolGatewayHttpError(
          422,
          "Gateway project must belong to the company",
          "gateway_project_invalid",
        );
    }
    if (input.issueId) {
      const [issue] = await db
        .select({ id: issues.id, projectId: issues.projectId })
        .from(issues)
        .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",
        );
      }
    }
  }

View on GitHub (pinned to 3f1d897a7c)