paperclipai/paperclip · error · ToolGatewayHttpError

local_stdio_template_invalid

local_stdio_template_invalid

Error message

Local stdio MCP connection requires an active approved template

What it means

resolveLocalStdioRuntimeTemplate could not produce a usable template: the referenced template is neither a built-in nor an active approved row in toolStdioCommandTemplates for the company. Local stdio runs are only allowed from active approved templates, so execution stops before spawning any process.

Solutions

  1. Approve (or re-approve) the stdio template referenced by the connection; inactive or unapproved templates cannot launch.
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

  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(

View on GitHub (pinned to 3f1d897a7c)