{"record":{"id":"8da8bce1e40a6d37","repo":"BerriAI/litellm","slug":"no-polling-url-in-bfl-response-8da8bc","errorCode":null,"errorMessage":"No polling_url in BFL response","messagePattern":"No polling_url in BFL response","errorType":"exception","errorClass":"BlackForestLabsError","httpStatus":500,"severity":"error","filePath":"litellm/llms/black_forest_labs/image_generation/handler.py","lineNumber":324,"sourceCode":"        # Parse initial response to get polling URL\n        try:\n            response_data: Final = initial_response.json()\n        except Exception as e:\n            raise BlackForestLabsError(\n                status_code=initial_response.status_code,\n                message=f\"Error parsing initial response: {e}\",\n            )\n\n        # Check for immediate errors\n        if \"errors\" in response_data:\n            raise BlackForestLabsError(\n                status_code=initial_response.status_code,\n                message=f\"BFL error: {response_data['errors']}\",\n            )\n\n        polling_url: Final = response_data.get(\"polling_url\")\n        if not polling_url:\n            raise BlackForestLabsError(\n                status_code=500,\n                message=\"No polling_url in BFL response\",\n            )\n\n        # Reject polling URLs that don't belong to BFL-controlled infrastructure.\n        # BFL uses regional subdomains (e.g. gateway.bfl.ai) that differ from the\n        # submission host (api.bfl.ai), so we validate against the registered\n        # domain rather than doing a strict same-origin check. VERIA-51.\n        assert_bfl_polling_url(polling_url)\n\n        # Get just the auth header for polling\n        polling_headers: Final = {\"x-key\": headers.get(\"x-key\", \"\")}\n\n        start_time: Final = time.time()\n        verbose_logger.debug(\"BFL starting sync polling at %s\", polling_url)\n\n        while time.time() - start_time < max_wait:\n            response = sync_client.get(","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/black_forest_labs/image_generation/handler.py#L306-L342","documentation":"Sync BFL flow: the initial response was JSON with HTTP < 400 and no `errors` key, but the `polling_url` field is missing, so LiteLLM cannot start polling and raises BlackForestLabsError(500). The expected contract is a submission response containing `polling_url` (BFL's async task model: submit, then poll until status == Ready). A missing field means an unexpected payload shape - contract change, or a custom base_url serving a BFL-incompatible API.","triggerScenarios":"BFL changes its submission-response schema (field renamed/moved); `api_base`/base_url pointing at a stub or third-party gateway that returns 200 JSON without polling_url; an intermediate cache returning a stale/partial response body.","commonSituations":"Old LiteLLM versions after BFL schema evolution; prototypes mocking the BFL API for tests without implementing polling_url; misrouted base_url hitting a status endpoint instead of the generation-submit endpoint.","solutions":["Upgrade LiteLLM to the latest version (schema fixes land there).","Log the full initial response body to see which field replaced `polling_url`, if any.","Verify base_url points at the generation submit endpoint and not a status/health route.","If mocking BFL, include `{\"id\": ..., \"status\": \"Queued\", \"polling_url\": \"https://...\"}` in the submit response."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from litellm.llms.black_forest_labs.common_utils import BlackForestLabsError\n\ntry:\n    resp = litellm.image_generation(model=\"flux-pro-1.1\", prompt=p)\nexcept BlackForestLabsError as e:\n    if \"No polling_url\" in str(e):\n        log.error(\"BFL submit response missing polling_url - schema drift or wrong base_url\")\n        raise\n    raise","preventionTips":["Upgrade litellm promptly when BFL ships API changes.","If mocking BFL in tests, always include polling_url in submit responses.","Point base_url at the submit endpoint exactly as documented."],"tags":["litellm","black-forest-labs","flux","response-parsing","schema-change","polling"],"backgroundTag":"missing-response-field","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}