conductor-oss/conductor · error · IOException
OpenAI Video download returned empty body
Error message
OpenAI Video download returned empty body
What it means
Thrown by OpenAIVideoApi.downloadVideoStream when the content endpoint returns 2xx but response.body() is null. The response is closed before throwing. A defensive guard for abnormal proxy/gateway behavior on a binary endpoint.
Source
Thrown at ai/src/main/java/org/conductoross/conductor/ai/providers/openai/api/OpenAIVideoApi.java:178
.url(baseUrl + "/v1/videos/" + videoId + "/content")
.header("Authorization", "Bearer " + apiKey)
.get()
.build();
// Do not use try-with-resources here: the caller owns the stream lifecycle
Response response = httpClient.newCall(request).execute();
if (!response.isSuccessful()) {
String errorBody = readResponseBody(response);
response.close();
throw new IOException(
"OpenAI Video download failed with status %d: %s"
.formatted(response.code(), errorBody));
}
ResponseBody body = response.body();
if (body == null) {
response.close();
throw new IOException("OpenAI Video download returned empty body");
}
return body.byteStream();
}
/**
* Download the completed video as a byte array.
*
* @param videoId The video job ID
* @return byte array of the MP4 binary data
*/
public byte[] downloadVideo(String videoId) throws IOException {
Request request =
new Request.Builder()
.url(baseUrl + "/v1/videos/" + videoId + "/content")
.header("Authorization", "Bearer " + apiKey)
.get()
.build();
View on GitHub (pinned to cf7c3e4a8a)
Solutions
- Call OpenAI directly bypassing proxies to confirm the body is present.
- Audit OkHttp interceptors on the shared client for premature body reads.
- Ensure the gateway passes through the binary content type and body unchanged.
Defensive patterns
Strategy: try-catch
Try / catch
try (InputStream in = videoApi.downloadVideoStream(videoId)) {
// consume
} catch (IOException e) {
if (e.getMessage().contains("empty body")) {
// proxy stripped the body; try the direct endpoint
} else {
throw e;
}
} Prevention
- Avoid OkHttp interceptors that consume response bodies.
- Verify proxies forward binary content unchanged.
- Test downloads against the direct OpenAI endpoint first.
When it happens
Trigger: A proxy or gateway strips the MP4 body while forwarding a 200, or an OkHttp interceptor consumes the body before downloadVideoStream reads it.
Common situations: Corporate proxy rewriting binary responses, a misconfigured CDN, or a shared httpClient with logging interceptors that fully drain large bodies.
Related errors
- OpenAI Video thumbnail download returned empty body
- OpenAI Video download failed with status %d: %s
- OpenAI Video download failed with status %d
- OpenAI Video thumbnail download failed with status %d
- Speech API returned empty body
AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14).
Data as JSON: /api/errors/c29911d2509d73cd.
Report an issue: GitHub.