paperclipai/paperclip · error · ToolGatewayHttpError
gateway_issue_invalid
gateway_issue_invalid
Error message
Gateway issue must belong to the company
What it means
assertGatewayContext validation: the issueId supplied for the gateway does not match any issue in the requesting company. The 422 gateway_issue_invalid comes from the company-scoped issues lookup and covers deleted, foreign-company, or malformed issue ids.
Source
Thrown at server/src/services/tool-gateway.ts:3525
});
}
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> {View on GitHub (pinned to 01ad858492)
Solutions
- Select an issue 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:3384 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/31e778f132f958fa.
Report an issue: GitHub.