{"record":{"id":"035a2ccc5d544389","repo":"BerriAI/litellm","slug":"no-image-url-in-bfl-result-035a2c","errorCode":null,"errorMessage":"No image URL in BFL result","messagePattern":"No image URL in BFL result","errorType":"exception","errorClass":"BlackForestLabsError","httpStatus":500,"severity":"error","filePath":"litellm/llms/black_forest_labs/image_generation/transformation.py","lineNumber":294,"sourceCode":"\n        result: Final = response_data.get(\"result\", {})\n\n        if not model_response.data:\n            model_response.data = []\n\n        # Handle single image (sample) or multiple images\n        if isinstance(result, dict) and \"sample\" in result:\n            model_response.data.append(ImageObject(url=result[\"sample\"]))\n        elif isinstance(result, list):\n            # Multiple images returned\n            for img in result:\n                if isinstance(img, str):\n                    model_response.data.append(ImageObject(url=img))\n                elif isinstance(img, dict) and \"url\" in img:\n                    model_response.data.append(ImageObject(url=img[\"url\"]))\n\n        if not model_response.data:\n            raise BlackForestLabsError(\n                status_code=500,\n                message=\"No image URL in BFL result\",\n            )\n\n        model_response.created = int(time.time())\n        return model_response\n\n    def get_error_class(\n        self, error_message: str, status_code: int, headers: dict | httpx.Headers\n    ) -> BlackForestLabsError:\n        \"\"\"Return the appropriate error class for Black Forest Labs.\"\"\"\n        return BlackForestLabsError(\n            status_code=status_code,\n            message=error_message,\n        )\n\n\ndef get_black_forest_labs_image_generation_config(","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/black_forest_labs/image_generation/transformation.py#L276-L312","documentation":"After parsing the final BFL response, the handler extracts result.sample (single image) or iterates result as a list of URL strings/objects with a 'url' key. If neither shape yields any image, model_response.data stays empty and this BlackForestLabsError (HTTP 500) is raised. It means the job reported 'Ready' but the payload had no usable image URL.","triggerScenarios":"BFL returns result as a dict without 'sample' (e.g. only 'progress' or an empty {}), or as a list whose items are neither strings nor {\"url\": ...} dicts — schema drift or an anomaly where 'Ready' was reported without a sample.","commonSituations":"BFL API schema changes moving the image URL to a new field (e.g. 'sample' renamed); requesting non-standard output formats whose result shape differs; rare server-side bugs returning Ready with an empty result.","solutions":["Log the full response_data['result'] payload to see where the URL actually lives.","Upgrade litellm — if BFL renamed the field, a newer integration likely handles it.","Retry the generation once; empty results with Ready status are usually anomalous.","If you control the request, avoid exotic output options that change the result shape, or open a litellm issue with the payload."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.images.generate(model=\"bfl/flux-pro-1.1\", prompt=p)\nexcept BlackForestLabsError as e:\n    if \"No image URL in BFL result\" in str(e):\n        logger.error(\"BFL reported Ready without a sample URL; payload logged for schema diff\")\n        return fallback_provider_generate(p)  # optional fallback\n    raise","preventionTips":["Pin and test your litellm version against BFL's current response schema.","Alert on this error specifically — it signals schema drift, not user error.","Keep a fallback image provider configured for production resilience."],"tags":["bfl","response-schema","image-url","image-generation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}