{"record":{"id":"055c505c066ddd3f","repo":"conductor-oss/conductor","slug":"empty-response-downloading-image-from","errorCode":null,"errorMessage":"Empty response downloading image from ","messagePattern":"Empty response downloading image from ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/providers/openai/OpenAIVideoModel.java","lineNumber":206,"sourceCode":"\n    /** Detects the MIME type from an input image specification. */\n    private String detectMimeType(String inputImage) {\n        if (inputImage.startsWith(\"data:\")) {\n            // Extract MIME type from data URI: data:image/png;base64,...\n            return inputImage.substring(5, inputImage.indexOf(\";\"));\n        } 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":188,"sourceCodeEnd":216,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/providers/openai/OpenAIVideoModel.java#L188-L216","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the inputImage URL returns actual image bytes by opening it in a browser or curling it.","Check for expired pre-signed URLs (S3/GCS signed URLs have a TTL — regenerate before submitting).","Ensure the URL directly serves the image file, not a redirect or HTML page.","If the image is local or short-lived, convert to a data: URI (data:image/png;base64,...) to avoid the network download entirely."],"exampleFix":"// before\nreq.setInputImage(\"https://s3.amazonaws.com/bucket/expired-presigned.jpg\");\n// after — use a data URI to avoid network fetch\nreq.setInputImage(\"data:image/png;base64,iVBORw0KGgo...\");\n// or a fresh valid URL\nreq.setInputImage(\"https://cdn.example.com/valid.jpg\");","handlingStrategy":"validation","validationCode":"// Validate input image URL returns non-empty content before using for video gen\nprivate void validateImageUrl(String url) throws IOException {\n    okhttp3.Request headRequest = new okhttp3.Request.Builder().url(url).head().build();\n    try (okhttp3.Response resp = httpClient.newCall(headRequest).execute()) {\n        long contentLength = resp.body() != null ? resp.body().contentLength() : -1;\n        if (!resp.isSuccessful()) {\n            throw new IllegalArgumentException(\n                \"Input image URL returned HTTP \" + resp.code());\n        }\n        if (contentLength == 0) {\n            throw new IllegalArgumentException(\n                \"Input image URL returns empty content: \" + url);\n        }\n    }\n}","typeGuard":"null","tryCatchPattern":"try {\n    videoModel.call(prompt); // internally calls downloadFromUrl\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Empty response downloading\")) {\n        throw new IllegalArgumentException(\n            \"Input image URL returns an empty body. Verify the URL serves actual image bytes \" +\n            \"or convert to a data: URI.\", e);\n    }\n    throw e;\n}","preventionTips":["Validate the input image URL with a HEAD request before submitting the video job.","Convert local or short-lived images to data: URIs to eliminate network dependency.","Ensure pre-signed S3/GCS URLs are fresh (not expired) before use.","Test the image URL independently (curl/browser) before using it in a video task."],"tags":["openai","video-generation","download","network","image","ai"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}