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.
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@3f1d897a7c (2026-09-18).
Data as JSON: /api/errors/60f15193feb2a1b6.
Report an issue: GitHub.
Appendix: source
Thrown at server/src/services/tool-gateway.ts:6475
"Gateway profile must belong to the company",
"gateway_profile_invalid",
);
}
if (input.agentId)
await assertAgentInCompany(input.companyId, input.agentId);
if (input.projectId) {
const [project] = await db
.select({ id: projects.id })
.from(projects)
.where(
and(
eq(projects.companyId, input.companyId),
eq(projects.id, input.projectId),
),
)
.limit(1);
if (!project)
throw new ToolGatewayHttpError(
422,
"Gateway project must belong to the company",
"gateway_project_invalid",
);
}
if (input.issueId) {
const [issue] = await db
.select({ id: issues.id, projectId: issues.projectId })
.from(issues)
.where(
and(
eq(issues.companyId, input.companyId),
eq(issues.id, input.issueId),
),
)
.limit(1);
if (!issue)
throw new ToolGatewayHttpError(View on GitHub (pinned to 3f1d897a7c)