OpenBB-finance/OpenBB · error · OpenBBError

No content returned from the request.

Error message

No content returned from the request.

What it means

Raised in the same bulk port-activity downloader when the response returned 200 but response.content is None — i.e. a successful status with an empty body from the ArcGIS hub download endpoint. Subsequent parsing (read_csv) would fail, so the helper aborts early with this explicit message.

Source

Thrown at openbb_platform/providers/imf/openbb_imf/utils/port_watch_helpers.py:271

    from openbb_core.app.model.abstract.error import OpenBBError
    from openbb_core.provider.utils.helpers import get_async_requests_session
    from pandas import read_csv, to_datetime

    url = (
        "https://hub.arcgis.com/api/v3/datasets/959214444157458aad969389b3ebe1a0_0/"
        + "downloads/data?format=csv&spatialRefId=4326&where=1%3D1"
    )
    content = ""
    try:
        async with await get_async_requests_session(
            timeout=120
        ) as session, await session.get(url) as response:
            if response.status != 200:
                raise OpenBBError(
                    f"Failed to fetch port activity data: {response.status} - {response.reason}"
                )
            if response.content is None:
                raise OpenBBError("No content returned from the request.")
            content = await response.text()

        df = read_csv(StringIO(content))
        df.date = to_datetime(df.date).dt.date
        df = df.drop(
            columns=[
                d
                for d in ["ObjectId", "GlobalID", "year", "month", "day"]
                if d in df.columns
            ]
        )

        return df.to_dict(orient="records")

    except Exception as e:
        raise OpenBBError(f"Error fetching port activity data: {e} -> {e.args}") from e

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Retry the bulk download — empty 200s are typically transient.
  2. If persistent, download the URL manually to confirm the endpoint serves bytes; if not, report the dataset id.
  3. Bypass intermediate proxies when fetching the ~800 MB payload.
Defensive patterns

Strategy: retry

Try / catch

try:
    records = await get_all_daily_port_activity_data()
except OpenBBError as e:
    if 'No content returned' in str(e):
        raise Retryable(str(e)) from e  # empty 200: transient, retry once or twice
    raise

Prevention

When it happens

Trigger: ArcGIS returning an empty 200 for the CSV download (server-side glitch, redirect body not followed, or proxy stripping the body).

Common situations: Flaky CDN edge nodes serving empty bodies on very large files; middleware (anti-virus/proxy) consuming the response body.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/a2fb35a661c3ce61. Report an issue: GitHub.