{"record":{"id":"47e332ef3e64dbea","repo":"vercel/ai","slug":"google-interactions-timed-out-polling-interaction","errorCode":null,"errorMessage":"google.interactions: timed out polling interaction ${interactionId} after ${timeoutMs}ms.","messagePattern":"google\\.interactions: timed out polling interaction (.+?) after (.+?)ms\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/google/src/interactions/poll-google-interactions.ts","lineNumber":95,"sourceCode":"\n  /*\n   * When the caller aborts, fire a best-effort `POST /interactions/{id}/cancel`\n   * so the run stops billing on Google's side. Wrap every exit path that's\n   * triggered by an abort -- the explicit `abortSignal.aborted` check, the\n   * AbortError thrown by `delay()`, and any AbortError thrown by `getFromApi`.\n   */\n  const cancelOnServer = () =>\n    cancelGoogleInteraction({ baseURL, interactionId, headers, fetch });\n\n  try {\n    while (true) {\n      if (abortSignal?.aborted) {\n        await cancelOnServer();\n        throw new DOMException('Polling was aborted', 'AbortError');\n      }\n\n      if (Date.now() - startedAt > timeoutMs) {\n        throw new Error(\n          `google.interactions: timed out polling interaction ${interactionId} after ${timeoutMs}ms.`,\n        );\n      }\n\n      await delay(nextDelayMs, { abortSignal });\n\n      const {\n        value: response,\n        rawValue: rawResponse,\n        responseHeaders,\n      } = await getFromApi({\n        url,\n        validateUrl: false,\n        headers,\n        failedResponseHandler: googleFailedResponseHandler,\n        successfulResponseHandler: createJsonResponseHandler(\n          googleInteractionsResponseSchema,\n        ),","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/google/src/interactions/poll-google-interactions.ts#L77-L113","documentation":"pollGoogleInteractionUntilTerminal gives up after timeoutMs (default 30 minutes) if the background interaction never reaches a terminal status (completed/failed/cancelled/incomplete). The library errs on the long side because agent runs like deep research can take tens of minutes, so hitting this means the interaction really has not finished in that window.","triggerScenarios":"Polling a background Google interaction whose elapsed wall-clock time since polling started exceeds timeoutMs while the status is still non-terminal — e.g. a stuck or very long agent run, or a low custom pollingTimeoutMs override.","commonSituations":"Long-running deep-research/agent interactions exceeding the 30-minute default; a caller setting providerOptions.google.pollingTimeoutMs too low; Google-side incidents leaving interactions in a pending state.","solutions":["Raise the timeout via providerOptions.google.pollingTimeoutMs (e.g. 60 * 60 * 1000).","Check the interaction status directly via GET /interactions/{id} to see if it is stuck or failed.","Retry the interaction from scratch if the server-side run appears wedged.","If you intentionally want a shorter wait, catch this error and fall back to polling yourself with the same interactionId."],"exampleFix":"// before\nconst model = google('gemini-...', { /* default 30 min polling */ });\n// after\nawait generateText({\n  model,\n  providerOptions: { google: { pollingTimeoutMs: 60 * 60 * 1000 } },\n});","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await pollGoogleInteractionUntilTerminal({ interactionId, timeoutMs: 30 * 60 * 1000 });\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith('google.interactions: timed out')) {\n    // check status via GET /interactions/{id} or restart the interaction\n  } else { throw error; }\n}","preventionTips":["Raise providerOptions.google.pollingTimeoutMs for long agent runs.","Keep the default 30-minute timeout unless you know your interactions finish faster.","Persist the interactionId so a timed-out poll can be resumed later.","Monitor Google status pages for incidents affecting long-running interactions."],"tags":["timeout","polling","google-interactions","background-task"],"backgroundTag":"polling-timeout","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}