BerriAI/litellm · error · BlackForestLabsError

Error parsing initial response: {e}

Error message

Error parsing initial response: {e}

What it means

Error "Error parsing initial response: {e}" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/black_forest_labs/image_edit/handler.py:316

            max_wait: Maximum time to wait in seconds
            interval: Polling interval in seconds
            timeout: Timeout for each individual polling request

        Returns:
            Final response with completed result
        """
        # Validate initial response status code
        if initial_response.status_code >= 400:
            raise BlackForestLabsError(
                status_code=initial_response.status_code,
                message=f"BFL initial request failed: {initial_response.text}",
            )

        # Parse initial response to get polling URL
        try:
            response_data: Final = initial_response.json()
        except Exception as e:
            raise BlackForestLabsError(
                status_code=initial_response.status_code,
                message=f"Error parsing initial response: {e}",
            )

        # Check for immediate errors
        if "errors" in response_data:
            raise BlackForestLabsError(
                status_code=initial_response.status_code,
                message=f"BFL error: {response_data['errors']}",
            )

        polling_url: Final = response_data.get("polling_url")
        if not polling_url:
            raise BlackForestLabsError(
                status_code=500,
                message="No polling_url in BFL response",
            )

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. The BFL response was not valid JSON; check the API status.

When it happens

Trigger: Thrown at litellm/llms/black_forest_labs/image_edit/handler.py:316 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/ed2ff1511a2c4492. Report an issue: GitHub.