{"record":{"id":"570e4d305d4780e5","repo":"paperclipai/paperclip","slug":"local-stdio-template-invalid","errorCode":"local_stdio_template_invalid","errorMessage":"Local stdio MCP connection requires an active approved template","messagePattern":"Local stdio MCP connection requires an active approved template","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":422,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":4806,"sourceCode":"\n  async function resolveLocalStdioRuntimeTemplate(\n    connection: typeof toolConnections.$inferSelect,\n  ): Promise<LocalStdioRuntimeTemplate> {\n    const templateId = localStdioTemplateId(connection);\n    const builtIn = BUILTIN_LOCAL_STDIO_RUNTIME_TEMPLATES[templateId];\n    if (builtIn) return { templateId, ...builtIn };\n    const [template] = await db\n      .select()\n      .from(toolStdioCommandTemplates)\n      .where(\n        and(\n          eq(toolStdioCommandTemplates.companyId, connection.companyId),\n          eq(toolStdioCommandTemplates.templateKey, templateId),\n        ),\n      )\n      .limit(1);\n    if (!template || template.status !== \"active\") {\n      throw new ToolGatewayHttpError(\n        422,\n        \"Local stdio MCP connection requires an active approved template\",\n        \"local_stdio_template_invalid\",\n        {\n          connectionId: connection.id,\n          templateId,\n        },\n      );\n    }\n    return {\n      templateId,\n      command: template.command,\n      args: template.args ?? [],\n      envKeys: template.envKeys ?? [],\n    };\n  }\n\n  async function localStdioEnvironment(","sourceCodeStart":4788,"sourceCodeEnd":4824,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/tool-gateway.ts#L4788-L4824","documentation":"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.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:2596 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Approve (or re-approve) the stdio template referenced by the connection; inactive or unapproved templates cannot launch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}