OpenBB-finance/OpenBB · error · EmptyDataError

The request was returned empty.

Error message

The request was returned empty.

What it means

EmptyDataError raised at the top of EconDbPortVolumeFetcher.transform_data when the extracted dict is falsy — i.e. the HTTP request succeeded and the response was a dict, but it is empty ({}). There is no 'Ports' key or any series to process.

Source

Thrown at openbb_platform/providers/econdb/openbb_econdb/models/port_volume.py:109

            f"Unexpected format of the response. -> Expected dict, got {str(response.__class__.__name__)}"
        )

    @staticmethod
    def transform_data(
        query: EconDbPortVolumeQueryParams,
        data: dict,
        **kwargs: Any,
    ) -> list[EconDbPortVolumeData]:
        """Transform the data."""
        # pylint: disable=import-outside-toplevel
        from openbb_econdb.utils.helpers import COUNTRY_MAP
        from pandas import DataFrame, concat, to_datetime

        df: DataFrame = DataFrame()
        res = data.copy()

        if not res:
            raise EmptyDataError("The request was returned empty.")

        ports = res.pop("Ports", None)
        code_to_city_map = {d["locode"]: d["name"] for d in ports}
        code_to_country_map = {d["locode"]: d["iso2"] for d in ports}
        port_codes = list(code_to_city_map)

        for code in port_codes:
            new_data: list = []
            for k, v in res.items():
                new_data.extend(
                    {
                        "date": d.get("Date"),
                        "port_code": code,
                        "port_name": code_to_city_map[code],
                        "country": code_to_country_map[code],
                        "measure": k,
                        "value": d.get(code),
                    }

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Retry the call — an empty object is usually a transient upstream state.
  2. Clear the local HTTP cache (~/.cache/openbb/http) if a bad empty response may have been cached.
  3. Verify by curling https://www.econdb.com/static/openbb/shipping.json directly.
Defensive patterns

Strategy: retry

Type guard

def has_port_data(payload: dict) -> bool:
    return bool(payload) and 'Ports' in payload

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
import time
for attempt in range(2):
    try:
        res = obb.economy.port_volume(provider='econdb', use_cache=False)
        break
    except EmptyDataError:
        if attempt:
            raise
        time.sleep(30)

Prevention

When it happens

Trigger: economy.port_volume(provider='econdb') when econdb.com serves an empty JSON object for shipping.json — typically an upstream generation glitch or a briefly broken deployment.

Common situations: Hitting the endpoint mid-update on EconDB's side; cached empty response from a previous failure.

Related errors


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