paperclipai/paperclip · error · ToolGatewayHttpError
gateway_profile_invalid
gateway_profile_invalid
Error message
Gateway profile must belong to the company
What it means
assertGatewayContext validation: the profileId supplied when creating/updating a gateway does not resolve to a tool profile in the same company. The 422 gateway_profile_invalid fires on the company-scoped select, catching both nonexistent ids and ids leaked from another company.
Solutions
- Select a gateway profile that belongs to the same company as the request.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/services/tool-gateway.ts:3367 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/a9a2caf5fa79c29b.
Report an issue: GitHub.
Appendix: source
Thrown at server/src/services/tool-gateway.ts:6455
companyId: string;
profileId?: string | null;
agentId?: string | null;
projectId?: string | null;
issueId?: string | null;
}) {
if (input.profileId) {
const [profile] = await db
.select({ id: toolProfiles.id })
.from(toolProfiles)
.where(
and(
eq(toolProfiles.companyId, input.companyId),
eq(toolProfiles.id, input.profileId),
),
)
.limit(1);
if (!profile)
throw new ToolGatewayHttpError(
422,
"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);View on GitHub (pinned to 3f1d897a7c)