{"record":{"id":"3d5501bd5c1e145b","repo":"vercel/ai","slug":"xai-video-generation-error","errorCode":"XAI_VIDEO_GENERATION_ERROR","errorMessage":"No request_id returned from xAI API.","messagePattern":"No request_id returned from xAI API\\.","errorType":"error_code","errorClass":"AISDKError","httpStatus":null,"severity":"error","filePath":"packages/xai/src/xai-video-model.ts","lineNumber":527,"sourceCode":"    } else {\n      endpoint = `${baseURL}/videos/generations`;\n    }\n\n    const { value: createResponse, responseHeaders } = await postJsonToApi({\n      url: endpoint,\n      headers: combineHeaders(this.config.headers(), options.headers),\n      body,\n      failedResponseHandler: xaiFailedResponseHandler,\n      successfulResponseHandler: createJsonResponseHandler(\n        xaiCreateVideoResponseSchema,\n      ),\n      abortSignal: options.abortSignal,\n      fetch: this.config.fetch,\n    });\n\n    const requestId = createResponse.request_id;\n    if (!requestId) {\n      throw new AISDKError({\n        name: 'XAI_VIDEO_GENERATION_ERROR',\n        message: `No request_id returned from xAI API.`,\n      });\n    }\n\n    return {\n      operation: { requestId },\n      warnings,\n      response: {\n        timestamp: currentDate,\n        modelId: this.modelId,\n        headers: responseHeaders,\n      },\n    };\n  }\n\n  async doStatus(\n    options: Parameters<NonNullable<VideoModelV4['doStatus']>>[0],","sourceCodeStart":509,"sourceCodeEnd":545,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/xai/src/xai-video-model.ts#L509-L545","documentation":"In doStart of the xAI video model, the create-video API response must contain a request_id used to poll generation status. If the response body has no request_id (empty, malformed, or an error payload parsed as success), the model throws AISDKError named XAI_VIDEO_GENERATION_ERROR because generation cannot be tracked without it.","triggerScenarios":"POSTing a video generation request to xAI where the HTTP response succeeds (or is misparsed) but lacks request_id — e.g. API schema change, proxy stripping the body, auth/entitlement error returned as non-standard payload.","commonSituations":"Corporate proxy or gateway rewriting the response; xAI API contract change; account without video-generation access returning an unexpected body; transient API incidents.","solutions":["Retry the generation request; if it reproduces, inspect the raw response body/headers for an underlying error message.","Verify the API key has xAI video-generation access and the model id is valid.","Check for network middlewares (proxies, mocks, older fetch interceptors) that might alter the response body.","Update @ai-sdk/xai to the latest version in case the response handling was adapted to an API change."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"function hasRequestId(r: unknown): r is { request_id: string } {\n  return typeof (r as any)?.request_id === 'string' && (r as any).request_id.length > 0;\n}","tryCatchPattern":"try {\n  await videoModel.doStart({ prompt, ... });\n} catch (e) {\n  if (AISDKError.isInstance(e) && e.name === 'XAI_VIDEO_GENERATION_ERROR') {\n    // log raw response context, retry with backoff; surface to user if persistent\n  } else throw e;\n}","preventionTips":["Retry generation requests with exponential backoff for transient API issues.","Verify API key entitlements for xAI video generation before deploying.","Beware proxies/mocks that mangle response bodies; test against the real endpoint shape in staging.","Pin and monitor @ai-sdk/xai versions for API contract updates."],"tags":["xai","video-generation","api-response","network"],"backgroundTag":"missing-request-id","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}