{"record":{"id":"f8b4952240a387ce","repo":"vercel/ai","slug":"video-generation-did-not-complete-after-webhook-no","errorCode":null,"errorMessage":"Video generation did not complete after webhook notification.","messagePattern":"Video generation did not complete after webhook notification\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ai/src/generate-video/generate-video.ts","lineNumber":598,"sourceCode":"    if (statusResult.providerMetadata != null) {\n      operationProviderMetadata ??= {};\n      mergeProviderMetadata(\n        operationProviderMetadata,\n        statusResult.providerMetadata,\n      );\n    }\n\n    if (statusResult.status === 'completed') {\n      return {\n        videos: statusResult.videos,\n        warnings: allWarnings,\n        providerMetadata: operationProviderMetadata,\n        response: statusResult.response,\n      };\n    }\n\n    if (webhookReceived != null) {\n      throw new Error(\n        'Video generation did not complete after webhook notification.',\n      );\n    }\n  }\n}\n\nasync function waitForWebhook({\n  received,\n  timeoutMs,\n  abortSignal,\n  delay,\n}: {\n  received: PromiseLike<Experimental_VideoModelV4OperationWebhook>;\n  timeoutMs: number;\n  abortSignal?: AbortSignal;\n  delay: (\n    delayInMs: number,\n    options?: { abortSignal?: AbortSignal },","sourceCodeStart":580,"sourceCodeEnd":616,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/ai/src/generate-video/generate-video.ts#L580-L616","documentation":"After a webhook notification arrived, the subsequent (or final) doStatus call still did not report a completed (or failed) status, so the flow cannot produce a result. The SDK throws because it cannot reconcile the webhook event with the provider's status endpoint.","triggerScenarios":"executeStartStatusFlow with webhookUrl configured: waitForWebhook resolved (webhookReceived != null) but the polled statusResult still indicates a non-terminal/non-success state.","commonSituations":"Provider sends webhook events out of order or before its status API is consistent; webhook payload parsed but status endpoint lags; provider bug where webhook signals progress rather than completion; network caching of stale status responses.","solutions":["Re-check status after a short delay with experimental_getVideoStatus instead of assuming failure.","Verify the webhookUrl endpoint is correct and the provider's webhook semantics match the SDK's expectations.","Increase tolerance/retry the status check; treat it as transient if the provider is eventually consistent.","If reproducible, report to the provider/SDK since the webhook and status endpoints disagree."],"exampleFix":"// before\nconst { video } = await op; // may throw after webhook\n// after\ntry {\n  const { video } = await op;\n} catch (e) {\n  if (e.message.includes('webhook')) {\n    const status = await experimental_getVideoStatus({ model, operation: op.operation }); // re-poll\n  }\n}","handlingStrategy":"retry","validationCode":"// ensure webhookUrl is a publicly reachable https endpoint before starting\nnew URL(webhookUrl); if (!webhookUrl.startsWith('https://')) throw new Error('webhookUrl must be public https');","typeGuard":"null","tryCatchPattern":"try {\n  const { video } = await op;\n} catch (e) {\n  if (e.message.includes('webhook')) {\n    // webhook arrived but status disagreed; re-poll before giving up\n    const status = await experimental_getVideoStatus({ model, operation: op.operation });\n  }\n}","preventionTips":["Use an eventually-consistent-friendly re-poll after webhooks.","Verify webhook endpoint reachability and provider webhook registration.","Check the provider's webhook semantics (progress vs completion events).","Keep provider SDK/package versions up to date."],"tags":["video","webhook","async-status"],"backgroundTag":"webhook-status-mismatch","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}