vercel/ai · error · Error
Prodia response missing multipart boundary in content-type:
Error message
Prodia response missing multipart boundary in content-type: ${contentType} What it means
The Prodia video model expects the provider API to answer video-generation jobs with a multipart response whose content-type declares a boundary. The handler extracts the boundary to split the body into the job JSON part and the output video part. A missing or boundary-less content-type means the body cannot be parsed, so the SDK throws immediately.
Source
Thrown at packages/prodia/src/prodia-video-model.ts:185
function createVideoMultipartResponseHandler() {
return async ({
response,
}: {
response: Response;
}): Promise<{
value: VideoMultipartResult;
responseHeaders: Record<string, string>;
}> => {
const contentType = response.headers.get('content-type') ?? '';
const responseHeaders: Record<string, string> = {};
response.headers.forEach((value, key) => {
responseHeaders[key] = value;
});
const boundaryMatch = contentType.match(/boundary=([^\s;]+)/);
if (!boundaryMatch) {
throw new Error(
`Prodia response missing multipart boundary in content-type: ${contentType}`,
);
}
const boundary = boundaryMatch[1];
const arrayBuffer = await response.arrayBuffer();
const bytes = new Uint8Array(arrayBuffer);
const parts = parseMultipart(bytes, boundary);
let jobResult: ProdiaJobResult | undefined;
let videoBytes: Uint8Array | undefined;
let videoMediaType = 'video/mp4';
for (const part of parts) {
const contentDisposition = part.headers['content-disposition'] ?? '';
const partContentType = part.headers['content-type'] ?? '';
View on GitHub (pinned to 69428b1f8b)
Solutions
- Check the content-type string embedded in the error message — application/json or text/html means an API-level error body was returned.
- Validate your Prodia API key and quota; fix auth/credit issues so the real multipart response is produced.
- Confirm the model id and endpoint are valid for the Prodia video API.
- Remove or reconfigure intermediaries (proxy, CDN, worker) that rewrite or strip the content-type header.
Example fix
// before: letting the SDK fail on an unexpected body
const video = await generateVideo({ model: prodia.video('...'), ... });
// after: pre-check the endpoint returns multipart for a test job
const probe = await fetch(endpoint, { headers: { authorization: `Bearer ${key}` } });
if (!(probe.headers.get('content-type') ?? '').includes('boundary=')) {
throw new Error('Unexpected Prodia response: ' + (await probe.text()));
} Defensive patterns
Strategy: validation
Validate before calling
const ct = response.headers.get('content-type') ?? '';
if (!/boundary=([^\s;]+)/.test(ct)) {
console.error('Non-multipart Prodia response:', ct);
// treat as API-level failure before handing to the model
} Type guard
function isMultipartContentType(contentType: string | null): boolean {
return contentType != null && /boundary=([^\s;]+)/.test(contentType);
} Try / catch
try {
const video = await generateVideo({ model: prodia.video(modelId), ... });
} catch (error) {
if (error instanceof Error && error.message.includes('missing multipart boundary')) {
// content-type in message reveals whether an error page/JSON was returned
}
throw error;
} Prevention
- Pre-check API key validity and quota before video jobs.
- Inspect the content-type string in the error message to distinguish auth/credit errors from proxy issues.
- Confirm model ids against the current Prodia video API.
- Bypass or reconfigure CDNs that strip multipart headers.
When it happens
Trigger: A doGenerate call on the Prodia video model where the HTTP response content-type is missing, non-multipart (e.g. application/json, text/html), or multipart without a boundary= parameter — usually because an error body, proxy, or wrong endpoint answered instead of the normal multipart job response.
Common situations: Video-generation job failed server-side and Prodia returned a JSON/HTML error; CDN or reverse proxy stripping the boundary parameter; using an endpoint/model id that does not return multipart; expired or unauthorized API key.
Related errors
- Prodia multipart response missing job part
- Prodia response missing multipart boundary in content-type:
- Prodia multipart response missing job part
- Prodia multipart response missing output video
- Video generation timed out after ${timeoutMs}ms.
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/52f3b54524a7801a.
Report an issue: GitHub.