{"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/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/black_forest_labs/image_generation/handler.py#L306-L342","documentation":"The submission JSON parsed cleanly and carried no 'errors' key, but the polling_url field BFL is supposed to return is absent. The handler needs that URL to track the job, so it raises a 500 BlackForestLabsError. Usually indicates an API schema drift, an unexpected response from a custom api_base, or BFL returning an error shape not caught by the 'errors' check.","triggerScenarios":"A 2xx submission response whose JSON has neither polling_url nor errors — e.g. a different BFL API version, a mock/gateway response, or a body like {\"id\": ...} from an unmapped schema.","commonSituations":"Custom api_base pointing at a BFL-compatible service with a different response contract; BFL API revision that changed the job envelope; test doubles returning simplified responses.","solutions":["Log the full submission JSON on failure to see which schema actually arrived.","Confirm api_base targets the official BFL endpoint or a fully schema-compatible one.","Upgrade LiteLLM — newer releases track BFL schema changes.","If BFL itself changed the contract, patch response_data.get(\"polling_url\") to the new key upstream of your deployment."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try:\n    img = litellm.image_generation(model=M, prompt=p)\nexcept Exception as e:\n    if \"No polling_url\" in str(e):\n        log.critical(\"BFL schema drift or bad api_base: %s\", e)\n    raise","preventionTips":["Freeze api_base to the official endpoint unless you own the alternative's schema.","Upgrade LiteLLM together with BFL API announcements.","Add a canary request after deploying new api_base configs."],"tags":["bfl","schema","polling","response-parsing","image-generation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}