vercel/ai · error · AISDKError
XAI_VIDEO_GENERATION_ERROR
XAI_VIDEO_GENERATION_ERROR
Error message
No request_id returned from xAI API.
What it means
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.
Source
Thrown at packages/xai/src/xai-video-model.ts:527
} else {
endpoint = `${baseURL}/videos/generations`;
}
const { value: createResponse, responseHeaders } = await postJsonToApi({
url: endpoint,
headers: combineHeaders(this.config.headers(), options.headers),
body,
failedResponseHandler: xaiFailedResponseHandler,
successfulResponseHandler: createJsonResponseHandler(
xaiCreateVideoResponseSchema,
),
abortSignal: options.abortSignal,
fetch: this.config.fetch,
});
const requestId = createResponse.request_id;
if (!requestId) {
throw new AISDKError({
name: 'XAI_VIDEO_GENERATION_ERROR',
message: `No request_id returned from xAI API.`,
});
}
return {
operation: { requestId },
warnings,
response: {
timestamp: currentDate,
modelId: this.modelId,
headers: responseHeaders,
},
};
}
async doStatus(
options: Parameters<NonNullable<VideoModelV4['doStatus']>>[0],View on GitHub (pinned to 69428b1f8b)
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.
Defensive patterns
Strategy: retry
Type guard
function hasRequestId(r: unknown): r is { request_id: string } {
return typeof (r as any)?.request_id === 'string' && (r as any).request_id.length > 0;
} Try / catch
try {
await videoModel.doStart({ prompt, ... });
} catch (e) {
if (AISDKError.isInstance(e) && e.name === 'XAI_VIDEO_GENERATION_ERROR') {
// log raw response context, retry with backoff; surface to user if persistent
} else throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Corporate proxy or gateway rewriting the response; xAI API contract change; account without video-generation access returning an unexpected body; transient API incidents.
Related errors
- FAL_VIDEO_GENERATION_ERROR
- xAI video status response exceeded ${MAX_PENDING_BODY_BYTES}
- ALIBABA_VIDEO_GENERATION_ERROR
- BLACK_FOREST_LABS_VIDEO_GENERATION_TIMEOUT
- BYTEDANCE_VIDEO_GENERATION_ERROR
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/3d5501bd5c1e145b.
Report an issue: GitHub.