{"record":{"id":"31e778f132f958fa","repo":"paperclipai/paperclip","slug":"gateway-issue-invalid","errorCode":"gateway_issue_invalid","errorMessage":"Gateway issue must belong to the company","messagePattern":"Gateway issue must belong to the company","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":422,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":6493,"sourceCode":"        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(\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","sourceCodeStart":6475,"sourceCodeEnd":6511,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/tool-gateway.ts#L6475-L6511","documentation":"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.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:3384 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Select an issue 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"}