conductor-oss/conductor · error · RuntimeException

Empty response downloading image from

Error message

Empty response downloading image from 

What it means

OpenAIVideoModel.downloadFromUrl() throws RuntimeException with message "Empty response downloading image from " + url when the OkHttp response body is null. This is the image-to-video input image fetcher: it downloads an image from an HTTP/HTTPS URL to use as the seed for Sora image-to-video generation. A null body means the server returned a response with no entity body (e.g. a 204, or a malformed server response).

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/providers/openai/OpenAIVideoModel.java:206

    /** Detects the MIME type from an input image specification. */
    private String detectMimeType(String inputImage) {
        if (inputImage.startsWith("data:")) {
            // Extract MIME type from data URI: data:image/png;base64,...
            return inputImage.substring(5, inputImage.indexOf(";"));
        } else if (inputImage.toLowerCase().endsWith(".png")) {
            return "image/png";
        } else if (inputImage.toLowerCase().endsWith(".webp")) {
            return "image/webp";
        }
        return "image/jpeg";
    }

    private byte[] downloadFromUrl(String url) {
        okhttp3.Request request = new okhttp3.Request.Builder().url(url).get().build();
        try (okhttp3.Response response = httpClient.newCall(request).execute()) {
            if (response.body() == null) {
                throw new RuntimeException("Empty response downloading image from " + url);
            }
            return response.body().bytes();
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new RuntimeException("Failed to download image from " + url, e);
        }
    }
}

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Verify the inputImage URL returns actual image bytes by opening it in a browser or curling it.
  2. Check for expired pre-signed URLs (S3/GCS signed URLs have a TTL — regenerate before submitting).
  3. Ensure the URL directly serves the image file, not a redirect or HTML page.
  4. If the image is local or short-lived, convert to a data: URI (data:image/png;base64,...) to avoid the network download entirely.

Example fix

// before
req.setInputImage("https://s3.amazonaws.com/bucket/expired-presigned.jpg");
// after — use a data URI to avoid network fetch
req.setInputImage("data:image/png;base64,iVBORw0KGgo...");
// or a fresh valid URL
req.setInputImage("https://cdn.example.com/valid.jpg");
Defensive patterns

Strategy: validation

Validate before calling

// Validate input image URL returns non-empty content before using for video gen
private void validateImageUrl(String url) throws IOException {
    okhttp3.Request headRequest = new okhttp3.Request.Builder().url(url).head().build();
    try (okhttp3.Response resp = httpClient.newCall(headRequest).execute()) {
        long contentLength = resp.body() != null ? resp.body().contentLength() : -1;
        if (!resp.isSuccessful()) {
            throw new IllegalArgumentException(
                "Input image URL returned HTTP " + resp.code());
        }
        if (contentLength == 0) {
            throw new IllegalArgumentException(
                "Input image URL returns empty content: " + url);
        }
    }
}

Type guard

null

Try / catch

try {
    videoModel.call(prompt); // internally calls downloadFromUrl
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("Empty response downloading")) {
        throw new IllegalArgumentException(
            "Input image URL returns an empty body. Verify the URL serves actual image bytes " +
            "or convert to a data: URI.", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: VideoGenRequest.inputImage is an HTTP/HTTPS URL. downloadFromUrl() issues a GET, the response has no body (response.body() == null), and the method throws. This happens when: the URL returns a redirect loop, the server returns 204 No Content, the URL points to a non-image resource that returns an empty body, or a CDN returns a cached empty response.

Common situations: Pre-signed S3/GCS URL that expired (returns empty or error); URL pointing to a directory listing rather than a file; URL behind authentication that returns an empty redirect; CDN misconfiguration returning empty bodies; URL returns HTML error page with no content-length.

Related errors


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