{"record":{"id":"ae857ee5532803f4","repo":"conductor-oss/conductor","slug":"openai-video-download-failed-with-status-d","errorCode":null,"errorMessage":"OpenAI Video download failed with status %d","messagePattern":"OpenAI Video download failed with status (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/providers/openai/api/OpenAIVideoApi.java","lineNumber":199,"sourceCode":"    }\n\n    /**\n     * Download the completed video as a byte array.\n     *\n     * @param videoId The video job ID\n     * @return byte array of the MP4 binary data\n     */\n    public byte[] downloadVideo(String videoId) throws IOException {\n        Request request =\n                new Request.Builder()\n                        .url(baseUrl + \"/v1/videos/\" + videoId + \"/content\")\n                        .header(\"Authorization\", \"Bearer \" + apiKey)\n                        .get()\n                        .build();\n\n        try (Response response = httpClient.newCall(request).execute()) {\n            if (!response.isSuccessful()) {\n                throw new IOException(\n                        \"OpenAI Video download failed with status %d\".formatted(response.code()));\n            }\n            ResponseBody body = response.body();\n            if (body == null) {\n                throw new IOException(\"OpenAI Video download returned empty body\");\n            }\n            return body.bytes();\n        }\n    }\n\n    /**\n     * Download the thumbnail for a completed video.\n     *\n     * @param videoId The video job ID\n     * @return byte array of the thumbnail image (webp format)\n     */\n    public byte[] downloadThumbnail(String videoId) throws IOException {\n        Request request =","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/providers/openai/api/OpenAIVideoApi.java#L181-L217","documentation":"Thrown by OpenAIVideoApi.downloadVideo (the byte[] variant) when GET /v1/videos/{id}/content returns non-2xx. Unlike the streaming variant (224), this message omits the error body and reports only the status code. IOException is thrown inside a try-with-resources so the response is auto-closed.","triggerScenarios":"Downloading before completion (400/409), expired asset (404/410), invalid key (401), or rate limiting (429). Same failure modes as 224 but the byte[] path loses the response body detail for diagnosis.","commonSituations":"Calling downloadVideo prematurely, asset TTL elapsed, or transient download errors on large MP4s loaded fully into memory.","solutions":["Gate the call on getVideoStatus()=='completed' first.","Prefer downloadVideoStream for large videos to avoid loading the whole MP4 into a byte[].","On 404/410 regenerate the video.","If you need the error body for diagnosis, use downloadVideoStream which captures it."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Gate on completion before downloading\nVideoStatusResponse status = videoApi.getVideoStatus(videoId);\nif (!\"completed\".equalsIgnoreCase(status.status())) {\n    throw new IllegalStateException(\"Video not completed: \" + status.status());\n}","typeGuard":null,"tryCatchPattern":"try {\n    byte[] mp4 = videoApi.downloadVideo(videoId);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"status 404\") || e.getMessage().contains(\"status 410\")) {\n        // asset expired - regenerate\n    } else {\n        throw e;\n    }\n}","preventionTips":["Only call downloadVideo after status is 'completed'.","Prefer downloadVideoStream for large videos to avoid memory pressure.","Treat 404/410 as terminal and regenerate.","Use downloadVideoStream if you need the error body for diagnosis."],"tags":["openai","video","sora","http","download"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}