paperclipai/paperclip · error · ToolGatewayHttpError

action_context_mismatch

action_context_mismatch

Error message

Tool action request does not belong to this interaction

What it means

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.

Solutions

  1. Use the tool action request that belongs to the current interaction; IDs from other interactions are rejected.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/services/tool-gateway.ts:5222 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/c5915b8d838a2689. Report an issue: GitHub.

Appendix: source

Thrown at server/src/services/tool-gateway.ts:9288

        .from(toolInvocations)
        .where(eq(toolInvocations.id, actionRequest.invocationId))
        .limit(1);
      if (!invocation || invocation.companyId !== input.companyId) {
        throw new ToolGatewayHttpError(
          404,
          "Tool invocation not found",
          "invocation_not_found",
        );
      }
      if (input.issueId !== undefined || input.interactionId !== undefined) {
        if (
          !input.issueId ||
          !input.interactionId ||
          actionRequest.issueId !== input.issueId ||
          actionRequest.interactionId !== input.interactionId ||
          invocation.issueId !== input.issueId
        ) {
          throw new ToolGatewayHttpError(
            409,
            "Tool action request does not belong to this interaction",
            "action_context_mismatch",
          );
        }
        const [originatingInteraction] = await db
          .select({ id: issueThreadInteractions.id })
          .from(issueThreadInteractions)
          .where(
            and(
              eq(issueThreadInteractions.id, input.interactionId),
              eq(issueThreadInteractions.companyId, input.companyId),
              eq(issueThreadInteractions.issueId, input.issueId),
            ),
          )
          .limit(1);
        if (!originatingInteraction) {
          throw new ToolGatewayHttpError(

View on GitHub (pinned to 3f1d897a7c)