paperclipai/paperclip · error · ToolGatewayHttpError

gateway_not_found

gateway_not_found

Error message

MCP gateway not found

What it means

getGatewayWithTokens found no toolMcpGateways row for the given gatewayId within the company. The 404 fires on the company-scoped lookup, so it also covers cross-company access attempts; the gateway was deleted or the id is wrong.

Solutions

  1. Verify the MCP gateway ID exists for this company; list gateways and use a valid one.
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    };
  }

  async function getGatewayWithTokens(
    companyId: string,
    gatewayId: string,
  ): Promise<ToolMcpGatewayWithTokens> {
    const [gateway] = await db
      .select()
      .from(toolMcpGateways)
      .where(
        and(
          eq(toolMcpGateways.companyId, companyId),
          eq(toolMcpGateways.id, gatewayId),
        ),
      )
      .limit(1);
    if (!gateway) {
      throw new ToolGatewayHttpError(
        404,
        "MCP gateway not found",
        "gateway_not_found",
      );
    }
    const tokens = await db
      .select()
      .from(toolMcpGatewayTokens)
      .where(
        and(
          eq(toolMcpGatewayTokens.companyId, companyId),
          eq(toolMcpGatewayTokens.gatewayId, gatewayId),
        ),
      )
      .orderBy(desc(toolMcpGatewayTokens.createdAt));
    return {
      ...toGateway(gateway),
      tokens: tokens.map(toGatewayToken),

View on GitHub (pinned to 3f1d897a7c)