BerriAI/litellm · error · BlackForestLabsError
Request failed: {e}
Error message
Request failed: {e} What it means
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.
Source
Thrown at litellm/llms/black_forest_labs/image_generation/handler.py:157
input=prompt,
api_key="",
additional_args={
"complete_input_dict": data,
"api_base": complete_url,
"headers": headers,
},
)
# Make initial request
try:
response: Final = sync_client.post(
url=complete_url,
headers=headers,
json=data,
timeout=timeout,
)
except Exception as e:
raise BlackForestLabsError(
status_code=500,
message=f"Request failed: {e}",
)
# Poll for result
final_response: Final = self._poll_for_result_sync(
initial_response=response,
headers=headers,
sync_client=sync_client,
)
# Transform response
return self.config.transform_image_generation_response(
model=model,
raw_response=final_response,
model_response=model_response,
logging_obj=logging_obj,
request_data=data,View on GitHub (pinned to 6c2dcb801b)
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.
Defensive patterns
Strategy: retry
Validate before calling
null
Type guard
null
Try / catch
from tenacity import retry, stop_after_attempt, wait_exponential
@retry(stop=stop_after_attempt(3), wait=wait_exponential(min=1, max=20),
retry_error_callback=lambda e: e)
def generate():
return litellm.image_generation(model=M, prompt=p) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Polling timed out after {max_wait} seconds
- Error from qdrant checking if /collections exist {collection
- Mavvrik FOCUS destination: register failed ({resp.status_cod
- Mavvrik FOCUS destination: failed to get signed URL ({resp.s
- Failed to fetch prompt '{prompt_id}' from API: {e}
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/591d80228c3af319.
Report an issue: GitHub.