{"record":{"id":"591d80228c3af319","repo":"BerriAI/litellm","slug":"request-failed-e-591d80","errorCode":null,"errorMessage":"Request failed: {e}","messagePattern":"Request failed: (.+?)","errorType":"exception","errorClass":"BlackForestLabsError","httpStatus":500,"severity":"error","filePath":"litellm/llms/black_forest_labs/image_generation/handler.py","lineNumber":157,"sourceCode":"            input=prompt,\n            api_key=\"\",\n            additional_args={\n                \"complete_input_dict\": data,\n                \"api_base\": complete_url,\n                \"headers\": headers,\n            },\n        )\n\n        # Make initial request\n        try:\n            response: Final = sync_client.post(\n                url=complete_url,\n                headers=headers,\n                json=data,\n                timeout=timeout,\n            )\n        except Exception as e:\n            raise BlackForestLabsError(\n                status_code=500,\n                message=f\"Request failed: {e}\",\n            )\n\n        # Poll for result\n        final_response: Final = self._poll_for_result_sync(\n            initial_response=response,\n            headers=headers,\n            sync_client=sync_client,\n        )\n\n        # Transform response\n        return self.config.transform_image_generation_response(\n            model=model,\n            raw_response=final_response,\n            model_response=model_response,\n            logging_obj=logging_obj,\n            request_data=data,","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/black_forest_labs/image_generation/handler.py#L139-L175","documentation":"This wraps any non-HTTP exception from the synchronous initial POST that submits the image-generation job to BFL (sync_client.post in image_generation/handler.py). Network errors, DNS failures, TLS problems, and timeouts surface here as a 500 BlackForestLabsError with the underlying exception text. It fires before polling begins, so no job was created.","triggerScenarios":"litellm.image_generation(model=\"black_forest_labs/...\", ...) where the initial POST to the BFL submission URL raises: ConnectError, ConnectTimeout, ReadTimeout, DNS resolution failure, SSLError, or proxy connection refusal.","commonSituations":"Egress blocked by firewall/security groups; wrong HTTPS_PROXY/HTTP_PROXY env vars; BFL API outage; transient network blips; self-signed TLS interception appliances; overly aggressive client timeout passed to the call.","solutions":["Read the embedded exception text — it distinguishes DNS vs TLS vs timeout vs proxy failures and dictates the fix.","Verify connectivity from the same host: curl -sS https://api.bfl.ai/ should reach the service (any HTTP response proves the path).","Fix proxy config (unset or correct HTTPS_PROXY) or open egress to api.bfl.ai.","Retry with backoff — connect errors and timeouts are frequently transient.","Increase the request timeout if the embedded error is a ReadTimeout."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"from tenacity import retry, stop_after_attempt, wait_exponential\n\n@retry(stop=stop_after_attempt(3), wait=wait_exponential(min=1, max=20),\n       retry_error_callback=lambda e: e)\ndef generate():\n    return litellm.image_generation(model=M, prompt=p)","preventionTips":["Pre-flight network checks (DNS + TCP to api.bfl.ai) before batch runs.","Validate proxy env vars in deployment config.","Classify embedded exception text: DNS/TLS fixes are config, timeouts are retries."],"tags":["bfl","network","http","image-generation","sync"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}