vercel/ai · error · Error
google.interactions: cannot poll a background interaction wi
Error message
google.interactions: cannot poll a background interaction without an id. The POST response did not include an interaction id.
What it means
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.
Source
Thrown at packages/google/src/interactions/poll-google-interactions.ts:68
interactionId,
headers,
fetch,
abortSignal,
initialDelayMs = DEFAULT_INITIAL_DELAY_MS,
maxDelayMs = DEFAULT_MAX_DELAY_MS,
timeoutMs = DEFAULT_TIMEOUT_MS,
}: {
baseURL: string;
interactionId: string | null | undefined;
headers: Record<string, string | undefined>;
fetch?: FetchFunction;
abortSignal?: AbortSignal;
initialDelayMs?: number;
maxDelayMs?: number;
timeoutMs?: number;
}): Promise<PollGoogleInteractionResult> {
if (interactionId == null || interactionId.length === 0) {
throw new Error(
'google.interactions: cannot poll a background interaction without an id. ' +
'The POST response did not include an interaction id.',
);
}
const startedAt = Date.now();
let nextDelayMs = initialDelayMs;
const url = `${baseURL}/interactions/${encodeURIComponent(interactionId)}`;
/*
* When the caller aborts, fire a best-effort `POST /interactions/{id}/cancel`
* so the run stops billing on Google's side. Wrap every exit path that's
* triggered by an abort -- the explicit `abortSignal.aborted` check, the
* AbortError thrown by `delay()`, and any AbortError thrown by `getFromApi`.
*/
const cancelOnServer = () =>
cancelGoogleInteraction({ baseURL, interactionId, headers, fetch });
View on GitHub (pinned to 69428b1f8b)
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
Example fix
// before
pollGoogleInteractionUntilTerminal({ model, interactionId: postResponse.id });
// after
if (postResponse.id == null || postResponse.id.length === 0) {
throw new Error('Background POST returned no interaction id: ' + JSON.stringify(postResponse));
}
pollGoogleInteractionUntilTerminal({ model, interactionId: postResponse.id }); Defensive patterns
Strategy: validation
Validate before calling
if (interactionId == null || interactionId.length === 0) {
throw new Error('Cannot poll: background POST returned no interaction id.');
} Type guard
function isPollableId(id: unknown): id is string {
return typeof id === 'string' && id.length > 0;
} Try / catch
try {
const result = await pollGoogleInteractionUntilTerminal({ model, interactionId });
} catch (error) {
if (error instanceof Error && error.message.includes('cannot poll a background interaction without an id')) {
// re-run the POST or surface the upstream failure
}
throw error;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Custom polling code wiring the POST response id into the poll helper without checking it; upstream API error responses missing id.
Related errors
- google.interactions: background POST response did not includ
- Video generation timed out after ${timeoutMs}ms.
- Transcription request was aborted
- Transcription failed: ${transcript.error ?? 'Unknown error'}
- Black Forest Labs poll response is Ready but missing result.
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/92d35e82bee43cc9.
Report an issue: GitHub.