{"record":{"id":"aee367fe66f024bd","repo":"paperclipai/paperclip","slug":"invocation-not-found","errorCode":"invocation_not_found","errorMessage":"Tool invocation not found","messagePattern":"Tool invocation not found","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":404,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":5351,"sourceCode":"        argumentsSummary,\n        reasonCode: \"approval_granted\",\n        matchedPolicyIds: invocation.matchedPolicyIds ?? [],\n      });\n      await reflectToolActionInteractionLifecycle({ actionRequestId, status: \"executed\" });\n    } catch (err) {\n      const message = err instanceof Error ? err.message : String(err);\n      await db\n        .update(toolInvocations)\n        .set({\n          status: \"failed\",\n          errorCode: \"tool_execution_failed\",\n          errorMessage: message,\n          completedAt: new Date(),\n          updatedAt: new Date(),\n        })\n        .where(eq(toolInvocations.id, invocation.id));\n      await reflectToolActionInteractionLifecycle({\n        actionRequestId,\n        status: \"failed\",\n        errorCode: \"tool_execution_failed\",\n        errorMessage: message,\n      });\n    }\n  }\n\n  async function waitForActionRequestExecution(actionRequestId: string) {\n    let deadline = Date.now() + ACTION_REQUEST_EXECUTION_WAIT_MS;\n    while (true) {\n      const [match] = await db\n        .select({\n          actionRequest: toolActionRequests,\n          invocationStatus: toolInvocations.status,\n          invocationStartedAt: toolInvocations.startedAt,\n        })\n        .from(toolActionRequests)\n        .innerJoin(toolInvocations, eq(toolInvocations.id, toolActionRequests.invocationId))","sourceCodeStart":5333,"sourceCodeEnd":5369,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/tool-gateway.ts#L5333-L5369","documentation":"Ask-first test-call status follow-up: the action request exists but the tool invocation it references is missing or in another company. The 404 invocation_not_found indicates data inconsistency between the action request and its invocation, or cross-company access.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:5183 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the tool invocation ID; refresh the invocation list and use a current ID."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}