OpenBB-finance/OpenBB · warning · EmptyDataError

The request was returned empty.

Error message

The request was returned empty.

What it means

Raised as EmptyDataError by FMPEconomicCalendar.a_url after all URLs for the (possibly chunked) date range were gathered: if every chunk either returned nothing or failed with a non-fatal OpenBBError (which is only warned about for multi-URL runs), 'results' stays empty and this error is raised. Note that UnauthorizedError is always re-raised, so this is not an auth failure.

Source

Thrown at openbb_platform/providers/fmp/openbb_fmp/models/economic_calendar.py:140

        async def get_one(url):
            """Get data for one URL."""
            n_urls = 1
            try:
                result = await amake_request(url, response_callback=response_callback)
                if result:
                    results.extend(result)
            except UnauthorizedError as e:
                raise e from e
            except OpenBBError as e:
                if len(urls) == 1 or (len(urls) > 1 and n_urls == len(urls)):
                    raise e from e
                warnings.warn(f"Error in fetching part of the data from FMP -> {e}")
            n_urls += 1

        await asyncio.gather(*[get_one(url) for url in urls])

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

        return results

    @staticmethod
    def transform_data(
        query: FMPEconomicCalendarQueryParams,
        data: list[dict],
        **kwargs: Any,
    ) -> list[FMPEconomicCalendarData]:
        """Transform the data."""
        return [FMPEconomicCalendarData.model_validate(d) for d in data]

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Retry after a short delay - per-chunk failures from rate limiting are only warned, so a retry may succeed
  2. Narrow the date range to a window known to contain events (e.g. a weekday around a Fed meeting)
  3. Check emitted warnings above the error - they carry the per-URL failure reasons ('Error in fetching part of the data from FMP -> ...')
  4. If it persists, call FMP's economic-calendar endpoint directly with the same key to check upstream status

Example fix

# before
res = obb.economy.calendar(provider='fmp', start_date='2024-12-25', end_date='2024-12-26')  # quiet window

# after
res = obb.economy.calendar(provider='fmp', start_date='2024-12-18', end_date='2024-12-20')
Defensive patterns

Strategy: retry

Validate before calling

from datetime import date, timedelta
# prefer windows likely to contain events (business days)
if (end_date - start_date).days >= 3 or (end_date - start_date).days < 0:
    raise ValueError('Pick a compact, past-facing window of a few business days')

Type guard

null

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
import asyncio
for attempt in range(3):
    try:
        cal = await obb.economy.calendar.async_(provider='fmp', start_date=s, end_date=e)
        break
    except EmptyDataError:
        if attempt == 2:
            cal = []
        else:
            await asyncio.sleep(2 ** attempt)  # per-chunk fetch failures were only warned

Prevention

When it happens

Trigger: Calling obb.economy.calendar(provider='fmp', start_date=..., end_date=...) where the window contains no events, or where every per-chunk request failed with a non-auth error (rate limit, 5xx) that was downgraded to a warning, leaving zero rows.

Common situations: Weekend/holiday windows with no economic events, date chunks racing FMP rate limits (each failure only warns), large ranges split into many URLs where all chunks silently failed, expired key raising UnauthorizedError instead (different error).

Related errors


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