{"record":{"id":"4d4c5a92f1e611a0","repo":"calesthio/OpenMontage","slug":"seedream-completed-but-no-images-returned","errorCode":null,"errorMessage":"Seedream completed but no images returned","messagePattern":"Seedream completed but no images returned","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/graphics/seedream_image.py","lineNumber":237,"sourceCode":"                elapsed += 10\n\n            if elapsed >= 300:\n                raise RuntimeError(\n                    f\"Seedream task timed out after {300}s\"\n                )\n\n            result_resp = requests.get(\n                f\"https://queue.fal.run/bytedance/seedream/requests/\"\n                f\"{request_id}\",\n                headers=headers,\n                timeout=30,\n            )\n            result_resp.raise_for_status()\n            result_data = result_resp.json()\n\n            images = result_data.get(\"images\", [])\n            if not images:\n                raise RuntimeError(\"Seedream completed but no images returned\")\n\n            ext = inputs.get(\"output_format\", \"jpeg\")\n            expected_paths = self._output_paths(\n                inputs.get(\"output_path\"), len(images), ext\n            )\n            output_paths = []\n            for img, output_path in zip(images, expected_paths):\n                image_url = img.get(\"url\")\n                if not image_url:\n                    continue\n                image_resp = requests.get(image_url, timeout=60)\n                image_resp.raise_for_status()\n\n                output_path.parent.mkdir(parents=True, exist_ok=True)\n                output_path.write_bytes(image_resp.content)\n                output_paths.append(str(output_path))\n\n        except Exception as e:","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/graphics/seedream_image.py#L219-L255","documentation":"Raised when the Seedream request reached COMPLETED and the result JSON was fetched, but result_data['images'] is missing or an empty list. The queue considers the task done yet delivered no image payloads, so there is nothing to download. Indicates a malformed completion or an API response-shape change (e.g. images moved under another key).","triggerScenarios":"Result endpoint returns {'status':'COMPLETED'} with images under 'output.images' or 'data.images' instead of top-level 'images'; upstream finished but produced zero images (empty response body normalized to []).","commonSituations":"fal.run result schema drift; a gateway stripping fields; rare upstream empty-completion bugs.","solutions":["Log result_data keys — if images live under another key, update the extraction line","Retry once: empty completions are occasionally transient","Report/verify against current fal.run queue result docs if the shape changed"],"exampleFix":"// before\nimages = result_data.get(\"images\", [])\n// after\nimages = (\n    result_data.get(\"images\")\n    or (result_data.get(\"output\") or {}).get(\"images\")\n    or (result_data.get(\"data\") or {}).get(\"images\")\n    or []\n)","handlingStrategy":"try-catch","validationCode":"null","typeGuard":null,"tryCatchPattern":"try:\n    paths = seedream_run(inputs)\nexcept RuntimeError as e:\n    if \"no images returned\" in str(e):\n        logger.error(\"seedream empty completion; raw result needed\")\n        return seedream_run(inputs)  # retry once; often transient\n    raise","preventionTips":["Capture and log full result JSON on completion","Watch fal.run result-schema changelog","Add a result-shape assertion layer that pages on drift"],"tags":["seedream","fal","response-parsing","api-schema"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}