{"record":{"id":"92d35e82bee43cc9","repo":"vercel/ai","slug":"google-interactions-cannot-poll-a-background-inte","errorCode":null,"errorMessage":"google.interactions: cannot poll a background interaction without an id. The POST response did not include an interaction id.","messagePattern":"google\\.interactions: cannot poll a background interaction without an id\\. The POST response did not include an interaction id\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/google/src/interactions/poll-google-interactions.ts","lineNumber":68,"sourceCode":"  interactionId,\n  headers,\n  fetch,\n  abortSignal,\n  initialDelayMs = DEFAULT_INITIAL_DELAY_MS,\n  maxDelayMs = DEFAULT_MAX_DELAY_MS,\n  timeoutMs = DEFAULT_TIMEOUT_MS,\n}: {\n  baseURL: string;\n  interactionId: string | null | undefined;\n  headers: Record<string, string | undefined>;\n  fetch?: FetchFunction;\n  abortSignal?: AbortSignal;\n  initialDelayMs?: number;\n  maxDelayMs?: number;\n  timeoutMs?: number;\n}): Promise<PollGoogleInteractionResult> {\n  if (interactionId == null || interactionId.length === 0) {\n    throw new Error(\n      'google.interactions: cannot poll a background interaction without an id. ' +\n        'The POST response did not include an interaction id.',\n    );\n  }\n\n  const startedAt = Date.now();\n  let nextDelayMs = initialDelayMs;\n  const url = `${baseURL}/interactions/${encodeURIComponent(interactionId)}`;\n\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","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/google/src/interactions/poll-google-interactions.ts#L50-L86","documentation":"pollGoogleInteractionUntilTerminal requires a non-empty interactionId to issue GET polls. If called with a null/empty id (typically because the initial POST response lacked one), it throws immediately with an explanatory message.","triggerScenarios":"Invoking pollGoogleInteractionUntilTerminal with interactionId null or '' — usually the result of a background POST response that did not include an interaction id (see error 358), passed straight through to polling.","commonSituations":"Custom polling code wiring the POST response id into the poll helper without checking it; upstream API error responses missing id.","solutions":["Check the POST response for an interaction id before polling and handle the error case explicitly","Inspect why the POST omitted the id (API error payload, auth/quota issue, wrong endpoint)","Update @ai-sdk/google for current interactions API schema","Retry the initial POST request"],"exampleFix":"// before\npollGoogleInteractionUntilTerminal({ model, interactionId: postResponse.id });\n// after\nif (postResponse.id == null || postResponse.id.length === 0) {\n  throw new Error('Background POST returned no interaction id: ' + JSON.stringify(postResponse));\n}\npollGoogleInteractionUntilTerminal({ model, interactionId: postResponse.id });","handlingStrategy":"validation","validationCode":"if (interactionId == null || interactionId.length === 0) {\n  throw new Error('Cannot poll: background POST returned no interaction id.');\n}","typeGuard":"function isPollableId(id: unknown): id is string {\n  return typeof id === 'string' && id.length > 0;\n}","tryCatchPattern":"try {\n  const result = await pollGoogleInteractionUntilTerminal({ model, interactionId });\n} catch (error) {\n  if (error instanceof Error && error.message.includes('cannot poll a background interaction without an id')) {\n    // re-run the POST or surface the upstream failure\n  }\n  throw error;\n}","preventionTips":["Always validate the POST response id before wiring it into polling","Capture the POST response body when id is missing to diagnose the upstream cause","Centralize background interactions handling in one helper that enforces id checks"],"tags":["google","interactions","background","polling","missing-id"],"backgroundTag":"missing-provider-response-field","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}