{"record":{"id":"60f15193feb2a1b6","repo":"paperclipai/paperclip","slug":"gateway-project-invalid","errorCode":"gateway_project_invalid","errorMessage":"Gateway project must belong to the company","messagePattern":"Gateway project must belong to the company","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":422,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":6475,"sourceCode":"          \"Gateway profile must belong to the company\",\n          \"gateway_profile_invalid\",\n        );\n    }\n    if (input.agentId)\n      await assertAgentInCompany(input.companyId, input.agentId);\n    if (input.projectId) {\n      const [project] = await db\n        .select({ id: projects.id })\n        .from(projects)\n        .where(\n          and(\n            eq(projects.companyId, input.companyId),\n            eq(projects.id, input.projectId),\n          ),\n        )\n        .limit(1);\n      if (!project)\n        throw new ToolGatewayHttpError(\n          422,\n          \"Gateway project must belong to the company\",\n          \"gateway_project_invalid\",\n        );\n    }\n    if (input.issueId) {\n      const [issue] = await db\n        .select({ id: issues.id, projectId: issues.projectId })\n        .from(issues)\n        .where(\n          and(\n            eq(issues.companyId, input.companyId),\n            eq(issues.id, input.issueId),\n          ),\n        )\n        .limit(1);\n      if (!issue)\n        throw new ToolGatewayHttpError(","sourceCodeStart":6457,"sourceCodeEnd":6493,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/tool-gateway.ts#L6457-L6493","documentation":"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.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:3376 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Select a project that belongs to the same company as the gateway request."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}