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.

Source

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

    return templateId.trim();
  }

  async function resolveLocalStdioRuntimeTemplate(connection: typeof toolConnections.$inferSelect): Promise<LocalStdioRuntimeTemplate> {
    const templateId = localStdioTemplateId(connection);
    const builtIn = BUILTIN_LOCAL_STDIO_RUNTIME_TEMPLATES[templateId];
    if (builtIn) return { templateId, ...builtIn };
    const [template] = await db
      .select()
      .from(toolStdioCommandTemplates)
      .where(and(
        eq(toolStdioCommandTemplates.companyId, connection.companyId),
        eq(toolStdioCommandTemplates.templateKey, templateId),
      ))
      .limit(1);
    if (!template || template.status !== "active") {
      throw new ToolGatewayHttpError(422, "Local stdio MCP connection requires an active approved template", "local_stdio_template_invalid", {
        connectionId: connection.id,
        templateId,
      });
    }
    return {
      templateId,
      command: template.command,
      args: template.args ?? [],
      envKeys: template.envKeys ?? [],
    };
  }

  async function localStdioEnvironment(
    session: ToolGatewaySession,
    connection: typeof toolConnections.$inferSelect,
    template: LocalStdioRuntimeTemplate,
    grant: typeof connectionGrants.$inferSelect,
  ): Promise<NodeJS.ProcessEnv> {
    const env: NodeJS.ProcessEnv = {};
    for (const key of ["PATH", "Path", "SystemRoot", "WINDIR", "COMSPEC", "PATHEXT"]) {

View on GitHub (pinned to 01ad858492)

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@01ad858492 (2026-08-18). Data as JSON: /api/errors/5d8797d3fdf969e2. Report an issue: GitHub.