paperclipai/paperclip · error · ToolGatewayHttpError
gateway_project_invalid
gateway_project_invalid
Error message
Gateway project must belong to the company
What it means
assertGatewayContext validation: the projectId supplied for the gateway does not exist in the requesting company. The 422 gateway_project_invalid is thrown from the company-scoped projects lookup, so the project was deleted, mis-typed, or belongs to another tenant.
Source
Thrown at server/src/services/tool-gateway.ts:3517
}
function localStdioTemplateId(connection: typeof toolConnections.$inferSelect): string {
const config = asRecord(connection.config) ?? {};
const templateId = config.templateId;
if (typeof templateId !== "string" || templateId.trim().length === 0) {
throw new ToolGatewayHttpError(422, "Local stdio MCP connection requires an approved templateId", "local_stdio_template_missing", {
connectionId: connection.id,
});
}
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 ?? [],
};View on GitHub (pinned to 01ad858492)
Solutions
- Select a project that belongs to the same company as the gateway request.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/services/tool-gateway.ts:3376 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/60f15193feb2a1b6.
Report an issue: GitHub.