{"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":2692,"sourceCode":"  ): Promise<string> {\n    const accessContext = {\n      consumerType: \"tool_connection\" as const,\n      consumerId: connection.id,\n      configPath,\n      actorType: \"system\" as const,\n      actorId: session.agentId,\n      responsibleUserId: grant.subjectUserId,\n      issueId: session.issueId,\n      heartbeatRunId: session.runId,\n    };\n    if (grant.kind !== \"user\") {\n      return secrets.resolveSecretValue(\n        connection.companyId,\n        ref.secretId,\n        ref.versionSelector ?? \"latest\",\n        { accessContext },\n      );\n    }\n    if (!grant.subjectUserId) {\n      throw new ToolGatewayHttpError(422, \"Personal authorization has no owner\", \"grant_owner_missing\", {\n        connectionId: connection.id,\n        grantId: grant.id,\n      });\n    }\n    const [secret] = await db.select({\n      scope: companySecrets.scope,\n      ownerUserId: companySecrets.ownerUserId,\n      userSecretDefinitionId: companySecrets.userSecretDefinitionId,\n    }).from(companySecrets).where(and(\n      eq(companySecrets.id, ref.secretId),\n      eq(companySecrets.companyId, connection.companyId),\n    )).limit(1);\n    if (\n      !secret\n      || secret.scope !== \"user\"\n      || secret.ownerUserId !== grant.subjectUserId","sourceCodeStart":2674,"sourceCodeEnd":2710,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/tool-gateway.ts#L2674-L2710","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":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}