conductor-oss/conductor · error · RuntimeException

Failed to download image from {url}

Error message

Failed to download image from {url}

What it means

GeminiVideoModel.downloadFromUrl() catches any checked Exception (IOException, etc.) during the input image download for image-to-video generation and wraps it. RuntimeException (including error 197) is rethrown unchanged first. The original exception is preserved as the cause. This covers transport-layer failures when fetching the input image from a URL.

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/providers/gemini/GeminiVideoModel.java:180

            }

        } catch (Exception e) {
            log.error("Failed to check Gemini Veo video status for operation {}", jobId, e);
            throw new RuntimeException("Failed to check video status: " + e.getMessage(), e);
        }
    }

    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. Inspect getCause() for the specific IOException.
  2. Verify the image URL host is reachable from the Conductor host (test with curl).
  3. Use inline base64 (data: URI) to avoid the network download entirely — the code path supports it and bypasses downloadFromUrl.
  4. If the image must be fetched from a URL, host it on a reliable CDN with proper TLS certificates.
  5. Increase OkHttp connectTimeout if the image host is slow to respond.

Example fix

// before — network download that may fail
String imageUrl = "https://internal-server/img.png";
VideoOptions opts = VideoOptionsBuilder.builder()
    .inputImage(imageUrl).build();

// after — inline base64, no download
byte[] imgBytes = Files.readAllBytes(Path.of("/data/img.png"));
String b64 = "data:image/png;base64," + Base64.getEncoder().encodeToString(imgBytes);
VideoOptions opts = VideoOptionsBuilder.builder()
    .inputImage(b64).build();
Defensive patterns

Strategy: retry

Validate before calling

// Pre-validate the input image URL reachability
void validateInputImageReachable(String url) {
    if (url == null || !url.startsWith("http")) return;
    try {
        java.net.HttpURLConnection conn =
            (java.net.HttpURLConnection) new java.net.URL(url).openConnection();
        conn.setRequestMethod("HEAD");
        conn.setConnectTimeout(5000);
        int code = conn.getResponseCode();
        if (code != 200) {
            throw new IllegalArgumentException(
                "Input image URL returned HTTP " + code + ": " + url);
        }
    } catch (java.io.IOException e) {
        throw new IllegalArgumentException(
            "Cannot reach input image URL: " + url, e);
    }
}

Try / catch

try {
    return videoModel.call(videoPrompt);
} catch (RuntimeException e) {
    if (e.getMessage().startsWith("Failed to download image")
            && e.getCause() instanceof java.io.IOException) {
        // Transient network error — retry once
        Thread.sleep(3000);
        return videoModel.call(videoPrompt);
    }
    throw e;
}

Prevention

When it happens

Trigger: IOException during the OkHttp GET for the input image URL: connection timeout, SSL error, connection refused, DNS failure for the image host, or the image server returns a non-2xx status that OkHttp surfaces as an IOException.

Common situations: Network firewall blocking the external image host. Image host is down or rate-limiting. DNS resolution failure for the image URL domain. OkHttp connect timeout too short. Self-signed certificate on the image host causing TLS failure.

Related errors


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