{"record":{"id":"5d8797d3fdf969e2","repo":"paperclipai/paperclip","slug":"gateway-issue-project-mismatch","errorCode":"gateway_issue_project_mismatch","errorMessage":"Gateway issue must belong to the selected project","messagePattern":"Gateway issue must belong to the selected project","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":422,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":6503,"sourceCode":"        .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(\n          422,\n          \"Gateway issue must belong to the company\",\n          \"gateway_issue_invalid\",\n        );\n      if (\n        input.projectId &&\n        issue.projectId &&\n        issue.projectId !== input.projectId\n      ) {\n        throw new ToolGatewayHttpError(\n          422,\n          \"Gateway issue must belong to the selected project\",\n          \"gateway_issue_project_mismatch\",\n        );\n      }\n    }\n  }\n\n  async function findGatewayForProtocolLocator(input: {\n    gatewayId?: string | null;\n    gatewayPublicId?: string | null;\n  }) {\n    if (input.gatewayId) {\n      const [gateway] = await db\n        .select()\n        .from(toolMcpGateways)\n        .where(eq(toolMcpGateways.id, input.gatewayId))\n        .limit(1);","sourceCodeStart":6485,"sourceCodeEnd":6521,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/tool-gateway.ts#L6485-L6521","documentation":"assertGatewayContext consistency check: the issue exists in the company but its projectId does not equal the projectId selected for the gateway. The 422 gateway_issue_project_mismatch prevents binding a gateway to an issue outside the chosen project scope; align the issue/project pair.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:3386 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose an issue within the selected project, or omit the project filter."],"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"}