{"record":{"id":"599cda06353f50be","repo":"vercel/ai","slug":"google-interactions-background-post-response-did","errorCode":null,"errorMessage":"google.interactions: background POST response did not include an interaction id; cannot stream the result.","messagePattern":"google\\.interactions: background POST response did not include an interaction id; cannot stream the result\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/google/src/interactions/google-interactions-language-model.ts","lineNumber":721,"sourceCode":"    pollingTimeoutMs: number | undefined;\n  }): Promise<LanguageModelV4StreamResult> {\n    const postResult = await postJsonToApi({\n      url,\n      headers: mergedHeaders,\n      body: args,\n      failedResponseHandler: googleFailedResponseHandler,\n      successfulResponseHandler: createJsonResponseHandler(\n        googleInteractionsResponseSchema,\n      ),\n      abortSignal: options.abortSignal,\n      fetch: this.config.fetch,\n    });\n\n    const { responseHeaders: postHeaders, value: postResponse } = postResult;\n    const interactionId = postResponse.id;\n\n    if (interactionId == null || interactionId.length === 0) {\n      throw new Error(\n        'google.interactions: background POST response did not include an interaction id; cannot stream the result.',\n      );\n    }\n\n    const headerServiceTier = postHeaders?.['x-gemini-service-tier'];\n\n    /*\n     * If the POST already returned a terminal status (e.g. cached, immediate\n     * failure, or `incomplete`), there is nothing to stream from the GET --\n     * synthesize directly from the response so the caller still gets a\n     * complete stream.\n     */\n    if (isTerminalStatus(postResponse.status)) {\n      const synthesized = synthesizeGoogleInteractionsAgentStream({\n        response: postResponse,\n        warnings,\n        generateId: this.config.generateId ?? defaultGenerateId,\n        includeRawChunks: options.includeRawChunks,","sourceCodeStart":703,"sourceCodeEnd":739,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/google/src/interactions/google-interactions-language-model.ts#L703-L739","documentation":"When streaming a background Google interactions request, the initial POST must return an interaction `id` so the model can poll/stream the result. If the POST response has no id, doStreamBackground throws because the result cannot be streamed.","triggerScenarios":"Calling streamText/doStream with background mode against google.interactions where the POST response body's `id` field is null or empty — e.g. an error response parsed without an id, or schema drift.","commonSituations":"Gemini API returning an error payload in the POST body; authentication/quota issues surfacing as incomplete responses; outdated package not matching the current interactions API shape.","solutions":["Log the POST response body to check for embedded error details (message, status)","Verify API key, quota, and that background mode is enabled/supported for the model and endpoint","Update @ai-sdk/google so the interactions response schema matches the current API","Retry the request; if the API consistently omits id, report with the sanitized response"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const post = /* background POST response */;\nif (post?.id == null || post.id.length === 0) {\n  // don't attempt streaming; log body and surface API error details\n}","typeGuard":"function hasInteractionId(res: unknown): res is { id: string } {\n  return typeof (res as any)?.id === 'string' && (res as any).id.length > 0;\n}","tryCatchPattern":"try {\n  const result = streamText({ model: google.interactions('gemini-...'), prompt, /* background */ });\n} catch (error) {\n  if (error instanceof Error && error.message.includes('did not include an interaction id')) {\n    // inspect POST body for API error; check auth/quota/background support\n  }\n  throw error;\n}","preventionTips":["Confirm background mode is supported for the model/endpoint and your API key tier","Keep @ai-sdk/google updated for interactions API changes","Log response headers/body on failure to capture embedded API errors"],"tags":["google","interactions","background","streaming","api-response"],"backgroundTag":"missing-provider-response-field","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}