{"record":{"id":"c5915b8d838a2689","repo":"paperclipai/paperclip","slug":"action-context-mismatch","errorCode":"action_context_mismatch","errorMessage":"Tool action request does not belong to this interaction","messagePattern":"Tool action request does not belong to this interaction","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":409,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":9288,"sourceCode":"        .from(toolInvocations)\n        .where(eq(toolInvocations.id, actionRequest.invocationId))\n        .limit(1);\n      if (!invocation || invocation.companyId !== input.companyId) {\n        throw new ToolGatewayHttpError(\n          404,\n          \"Tool invocation not found\",\n          \"invocation_not_found\",\n        );\n      }\n      if (input.issueId !== undefined || input.interactionId !== undefined) {\n        if (\n          !input.issueId ||\n          !input.interactionId ||\n          actionRequest.issueId !== input.issueId ||\n          actionRequest.interactionId !== input.interactionId ||\n          invocation.issueId !== input.issueId\n        ) {\n          throw new ToolGatewayHttpError(\n            409,\n            \"Tool action request does not belong to this interaction\",\n            \"action_context_mismatch\",\n          );\n        }\n        const [originatingInteraction] = await db\n          .select({ id: issueThreadInteractions.id })\n          .from(issueThreadInteractions)\n          .where(\n            and(\n              eq(issueThreadInteractions.id, input.interactionId),\n              eq(issueThreadInteractions.companyId, input.companyId),\n              eq(issueThreadInteractions.issueId, input.issueId),\n            ),\n          )\n          .limit(1);\n        if (!originatingInteraction) {\n          throw new ToolGatewayHttpError(","sourceCodeStart":9270,"sourceCodeEnd":9306,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/tool-gateway.ts#L9270-L9306","documentation":"Scope validation when filtering action requests by issue/interaction: the action request's issueId/interactionId do not match the supplied pair (or one is missing while the other is given). The 409 action_context_mismatch prevents acting on a request outside the interaction being viewed.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:5222 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the tool action request that belongs to the current interaction; IDs from other interactions are rejected."],"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"}