OpenBB-finance/OpenBB · warning · EmptyDataError

The request returned empty.

Error message

The request returned empty.

What it means

EmptyDataError from the EconDB country-profile fetcher: countries validated fine, but after fetching each country's profile in chunks of 3, every country returned an empty DataFrame (each logged 'Error: No data returned for {country}'), so `results` stayed empty.

Source

Thrown at openbb_platform/providers/econdb/openbb_econdb/models/country_profile.py:294

            if (
                "Govt Debt/GDP" in final_df.columns
                and "GDP ($B USD)" in final_df.columns
            ):
                final_df["Govt Debt/GDP"] = (
                    final_df["Govt Debt/GDP"] / final_df["GDP ($B USD)"]
                )
            if "Current Account/GDP" in final_df.columns and _country == "US":
                final_df["Current Account/GDP"] = final_df["Current Account/GDP"] * 4
            if final_df.empty:
                warn(f"Error: No data returned for {_country}.")
            if not final_df.empty:
                results.extend(final_df.reset_index().to_dict(orient="records"))

        chunks = [country[i : i + 3] for i in range(0, len(country), 3)]
        for chunk in chunks:
            await asyncio.gather(*[get_one_country(c) for c in chunk])
        if not results:
            raise EmptyDataError("The request returned empty.")
        return results

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

        output_df = (
            DataFrame(data)
            .filter(items=["date", "Country"] + PROFILE_ORDER, axis=1)
            .sort_values("GDP ($B USD)", ascending=False)
            .fillna("N/A")

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Check the warnings output — it lists each country that returned nothing, telling you whether it's all or only some.
  2. Retry with a well-covered country (US, DE, JP) to distinguish 'country unsupported' from 'site down'.
  3. Update openbb-econdb; profile scraping breaks on site redesigns.
  4. If all countries fail, verify econdb.com reachability and any configured credentials from your environment.

Example fix

# before
res = obb.economy.country_profile(provider="econdb", country="all")  # everything empty -> raises

# after
import warnings
with warnings.catch_warnings(record=True) as w:
    warnings.simplefilter("always")
    try:
        res = obb.economy.country_profile(provider="econdb", country="US")
    except Exception as e:
        print([str(x.message) for x in w])  # which countries failed
        raise
Defensive patterns

Strategy: try-catch

Try / catch

import warnings
from openbb_core.provider.utils.errors import EmptyDataError
with warnings.catch_warnings(record=True) as w:
    warnings.simplefilter("always")
    try:
        res = obb.economy.country_profile(provider="econdb", country=cs)
    except EmptyDataError:
        failed = [str(x.message) for x in w]  # which countries returned nothing
        res = fallback_provider(cs) or None

Prevention

When it happens

Trigger: Calling obb.economy.country_profile(provider='econdb', country='...') when EconDB's profile endpoint returns nothing for all requested countries — site outage/rewrite, token required, or countries EconDB simply has no profile table for.

Common situations: EconDB layout change breaking an older openbb-econdb version; requesting obscure territories EconDB lacks; API token (if configured) expired so all profile requests come back empty; transient full-site unavailability.

Related errors


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