{"record":{"id":"ec99c7ccf0c6e504","repo":"conductor-oss/conductor","slug":"failed-to-download-image-from","errorCode":null,"errorMessage":"Failed to download image from ","messagePattern":"Failed to download image from ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/providers/openai/OpenAIVideoModel.java","lineNumber":212,"sourceCode":"        } else if (inputImage.toLowerCase().endsWith(\".png\")) {\n            return \"image/png\";\n        } else if (inputImage.toLowerCase().endsWith(\".webp\")) {\n            return \"image/webp\";\n        }\n        return \"image/jpeg\";\n    }\n\n    private byte[] downloadFromUrl(String url) {\n        okhttp3.Request request = new okhttp3.Request.Builder().url(url).get().build();\n        try (okhttp3.Response response = httpClient.newCall(request).execute()) {\n            if (response.body() == null) {\n                throw new RuntimeException(\"Empty response downloading image from \" + url);\n            }\n            return response.body().bytes();\n        } catch (RuntimeException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new RuntimeException(\"Failed to download image from \" + url, e);\n        }\n    }\n}\n","sourceCodeStart":194,"sourceCodeEnd":216,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/providers/openai/OpenAIVideoModel.java#L194-L216","documentation":"OpenAIVideoModel.downloadFromUrl() catches a non-RuntimeException and wraps it in RuntimeException with message \"Failed to download image from \" + url. This is the fallback catch for the image-to-video input image download: any checked Exception (IOException from the OkHttp execute()/bytes() call, or other I/O error) is wrapped. RuntimeExceptions (including error 214) are rethrown unchanged.","triggerScenarios":"VideoGenRequest.inputImage is an HTTP/HTTPS URL. The OkHttp GET request throws an IOException: DNS resolution failure, connection refused, connection timeout, read timeout (slow server), TLS handshake failure, or the server resets the connection.","commonSituations":"Input image hosted on a server behind a firewall blocking the Conductor worker; DNS not resolving the image hostname; slow image server causing read timeout; TLS certificate issues; the URL host is down; network partition between the Conductor worker and the image CDN.","solutions":["Verify the URL is reachable from the Conductor worker's network (curl from the worker host).","Check DNS resolution and firewall rules for the image hostname.","Increase the OkHttp read timeout if the image server is slow (configured via AIHttpClients / OpenAIConfiguration timeout).","Convert the image to a data: URI or raw base64 to avoid the network dependency entirely.","Host the image on a reliable CDN or local file server accessible to the worker."],"exampleFix":"// before\nreq.setInputImage(\"https://internal-lan-host:8080/image.jpg\"); // unreachable from worker\n// after — embed the image to avoid network\nreq.setInputImage(\"data:image/jpeg;base64,\" + Base64.getEncoder().encodeToString(imageBytes));","handlingStrategy":"try-catch","validationCode":"// Validate input image URL reachability before video job submission\nprivate void validateImageReachable(String url) {\n    try {\n        URI uri = URI.create(url);\n        String host = uri.getHost();\n        if (host == null) {\n            throw new IllegalArgumentException(\"Invalid image URL (no host): \" + url);\n        }\n        // Optionally: resolve DNS and do a connectivity check\n        java.net.InetAddress.getByName(host); // throws if DNS fails\n    } catch (Exception e) {\n        throw new IllegalArgumentException(\n            \"Input image URL is not reachable: \" + url, e);\n    }\n}","typeGuard":"null","tryCatchPattern":"try {\n    videoModel.call(prompt);\n} catch (RuntimeException e) {\n    Throwable cause = e.getCause();\n    if (cause != null && cause instanceof Exception) {\n        String msg = cause.getMessage() != null ? cause.getMessage() : \"\";\n        if (msg.contains(\"download image\") || msg.contains(\"Failed to download\")) {\n            // Network error fetching input image\n            throw new IllegalArgumentException(\n                \"Cannot download input image from URL. \" +\n                \"Verify network access or use a data: URI.\", e);\n        }\n    }\n    throw e;\n}","preventionTips":["Verify the input image host is reachable and resolvable from the Conductor worker.","Convert images to data: URIs or base64 to avoid network download entirely.","Ensure the OkHttp read timeout is sufficient for large images.","Use a reliable CDN or local file server for input images."],"tags":["openai","video-generation","download","network","image","io","ai"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}