OpenBB-finance/OpenBB · warning · EmptyDataError

The request was returned empty.

Error message

The request was returned empty.

What it means

Raised at the top of FMPRevenueGeographicFetch.transform_data when the raw payload list passed to the transformer is empty, i.e. FMP answered with `[]` before any flattening was attempted. It is distinct from the 'Unknown error while transforming' sibling raised at line 104, which fires after flattening yields nothing.

Source

Thrown at openbb_platform/providers/fmp/openbb_fmp/models/revenue_geographic.py:77

        # pylint: disable=import-outside-toplevel
        from openbb_fmp.utils.helpers import get_data_many

        api_key = credentials.get("fmp_api_key") if credentials else ""
        base_url = (
            "https://financialmodelingprep.com/stable/revenue-geographic-segmentation?"
        )
        url = f"{base_url}symbol={query.symbol}&period={query.period}&structure=flat&apikey={api_key}"
        return await get_data_many(url, **kwargs)

    @staticmethod
    def transform_data(
        query: FMPRevenueGeographicQueryParams,
        data: list[dict],
        **kwargs: Any,
    ) -> list[FMPRevenueGeographicData]:
        """Return the transformed data."""
        if not data:
            raise EmptyDataError("The request was returned empty.")

        results: list[FMPRevenueGeographicData] = []
        # We need to flatten the data.
        for item in data:
            period_ending = item.get("date")
            fiscal_year = item.get("fiscalYear")
            fiscal_period = item.get("period")
            segment = item.get("data", {})

            for region, revenue_value in segment.items():
                if revenue_value is not None:
                    revenue = int(revenue_value) if revenue_value is not None else None
                    if revenue is not None:
                        results.append(
                            FMPRevenueGeographicData.model_validate(
                                {
                                    "period_ending": period_ending,
                                    "fiscal_year": fiscal_year,

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Confirm the ticker is valid and listed on a major exchange
  2. Switch query.period between 'annual' and 'quarter' - one may have coverage where the other does not
  3. Test the raw endpoint https://financialmodelingprep.com/api/v4/revenue-geographic-segmentation?symbol=X&period=annual&structure=flat&apikey=KEY to see the empty list first-hand
  4. Fall back to another provider for the revenue_geographic router
Defensive patterns

Strategy: validation

Validate before calling

resp = requests.get(f"https://financialmodelingprep.com/api/v4/revenue-geographic-segmentation?symbol={symbol}&period={period}&structure=flat&apikey={key}")
if not resp.json():
    raise Skip(f'{symbol} has no geographic segmentation on FMP')

Type guard

def is_non_empty_list(data: object) -> bool:
    return isinstance(data, list) and len(data) > 0

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
try:
    rows = await obb.economy.revenue_geographic(symbol=symbol, provider='fmp').await_to_list()
except EmptyDataError:
    rows = []

Prevention

When it happens

Trigger: Calling the FMP revenue-geographic-segments endpoint with a symbol that has no geographic breakdown, or with a period parameter (annual/quarter) that has no records; the URL is built as symbol={symbol}&period={period}&structure=flat.

Common situations: Symbols without geographic revenue disclosure (common for domestic-only companies), delisted tickers, free-tier keys limited to a subset of companies, or requesting 'quarter' period when only annual segment data exists.

Related errors


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