OpenBB-finance/OpenBB · warning · EmptyDataError

Unknown error while transforming the data.

Error message

Unknown error while transforming the data.

What it means

Raised at the end of FMPRevenueGeographicFetch.transform_data when the flattening loop (iterating each period's 'data' dict of region->revenue) appended nothing, so `results` is empty. The API returned periods, but every region value was None or the segment dicts were empty. Sister of error 441, which fires when the raw list itself was empty.

Source

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

            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,
                                    "fiscal_period": fiscal_period,
                                    "region": region.replace("Segment", "").strip(),
                                    "revenue": revenue,
                                }
                            )
                        )

        if not results:
            raise EmptyDataError("Unknown error while transforming the data.")

        return sorted(results, key=lambda x: (x.period_ending or "", x.revenue or 0))

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Inspect the raw FMP response to see whether segment values are null vs missing
  2. Narrow the date range to recent fiscal years where segment reporting is complete
  3. Try provider alternatives or the business-line endpoint, which may have coverage where geographic does not
  4. If the response is a premium-tier message instead of nulls, upgrade the FMP key tier
Defensive patterns

Strategy: try-catch

Validate before calling

rows = requests.get(f"{url}&apikey={key}").json()
any_values = any(any(v is not None for v in r.get('data', {}).values()) for r in rows)

Type guard

def has_non_null_segments(data: list[dict]) -> bool:
    return any(
        any(v is not None for v in item.get("data", {}).values())
        for item in data
    )

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 as e:
    if 'transforming' in str(e):
        rows = []  # segments exist but are all null - skip or fall back
    else:
        raise

Prevention

When it happens

Trigger: FMP returns rows like {'date': '2023-12-31', 'data': {'unitedStates': None, 'canada': None}} where all segment values are null, so `if revenue_value is not None` filters out every entry.

Common situations: Companies whose geographic segmentation is reported but nulled out in FMP's dataset; partially-covered symbols on lower subscription tiers; periods early in a company's history before segment reporting began.

Related errors


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