conductor-oss/conductor · error · IOException

OpenAI Video thumbnail download returned empty body

Error message

OpenAI Video thumbnail download returned empty body

What it means

Thrown by OpenAIVideoApi.downloadThumbnail when the thumbnail endpoint returns 2xx but response.body() is null. Defensive guard analogous to 225/227 but for the webp thumbnail binary.

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/providers/openai/api/OpenAIVideoApi.java:232

     * @return byte array of the thumbnail image (webp format)
     */
    public byte[] downloadThumbnail(String videoId) throws IOException {
        Request request =
                new Request.Builder()
                        .url(baseUrl + "/v1/videos/" + videoId + "/content?variant=thumbnail")
                        .header("Authorization", "Bearer " + apiKey)
                        .get()
                        .build();

        try (Response response = httpClient.newCall(request).execute()) {
            if (!response.isSuccessful()) {
                throw new IOException(
                        "OpenAI Video thumbnail download failed with status %d"
                                .formatted(response.code()));
            }
            ResponseBody body = response.body();
            if (body == null) {
                throw new IOException("OpenAI Video thumbnail download returned empty body");
            }
            return body.bytes();
        }
    }

    // -- Helpers --

    /** Safely read the response body as a string, returning empty string if body is null. */
    private String readResponseBody(Response response) throws IOException {
        ResponseBody body = response.body();
        return body != null ? body.string() : "";
    }

    /** Map a MIME type to a file extension for the multipart upload filename. */
    private String extensionForMimeType(String mimeType) {
        return switch (mimeType) {
            case "image/png" -> "png";
            case "image/webp" -> "webp";

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Call OpenAI directly to confirm the thumbnail body is present.
  2. Audit OkHttp interceptors for premature body consumption.
  3. Ensure the gateway passes binary content through unchanged.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    byte[] thumb = videoApi.downloadThumbnail(videoId);
} catch (IOException e) {
    if (e.getMessage().contains("empty body")) {
        // proxy stripped body; treat thumbnail as unavailable
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: A proxy/gateway returns 200 with no body for the thumbnail endpoint, or an OkHttp interceptor consumes the body first.

Common situations: Misconfigured proxy stripping binary responses, shared httpClient logging interceptors draining bodies.

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/af9a62ee77777b40. Report an issue: GitHub.