OpenBB-finance/OpenBB · warning · EmptyDataError
The request was returned empty.
Error message
The request was returned empty.
What it means
Raised in FREDYieldCurveFetcher.extract_data (openbb_fred/models/yield_curve.py:76) when the delegated FredSeriesFetcher result is falsy for the requested yield_curve_type ('monthly' or 'daily' fixed Treasury CMT series sets). The code then immediately calls data.result, so this guard mainly protects against a None/empty fetcher response. In practice the more common failure is an empty .result list, which passes this check and surfaces as empty output rather than this error.
Solutions
- Confirm a valid fred_api_key is configured.
- Retry after a minute to rule out rate limiting.
- If the call 'succeeds' but returns no rows, fetch the CMT series directly (e.g. DGS10) via fred_series to confirm availability.
Defensive patterns
Strategy: try-catch
Try / catch
from openbb_core.provider.utils.errors import EmptyDataError
try:
curve = obb.economy.fred.yield_curve(yield_curve_type=t)
except EmptyDataError:
curve = None # degrade gracefully, e.g. serve last cached curve
curve = load_cached_curve(t) Prevention
- The endpoint fetches ~a dozen series per call - account for that in rate-limit budgets.
- Cache the daily curve; it changes once per business day.
When it happens
Trigger: economy/fred yield-curve while rate limited such that the internal fetcher returns nothing; a malformed credentials dict leaving api_key empty; unexpected fetcher API changes returning a falsy result object.
Common situations: High-frequency jobs hitting FRED's 50-req/min cap; missing fred_api_key causing the inner series fetch to fail into an empty result.
Related errors
- The request was returned empty.
- Data not found
- Error: No data to plot.
- "\n".join(messages) # messages contain e.g. 'No data was…
- No data found for the given query. Try adjusting the…
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/9ee03924e584b90d.
Report an issue: GitHub.
Appendix: source
Thrown at openbb_platform/providers/fred/openbb_fred/models/yield_curve.py:76
def transform_query(params: dict[str, Any]) -> FREDYieldCurveQueryParams:
"""Transform query."""
return FREDYieldCurveQueryParams(**params)
@staticmethod
async def aextract_data(
query: FREDYieldCurveQueryParams,
credentials: dict[str, str] | None,
**kwargs: Any
) -> list[dict]:
"""Extract data."""
api_key = credentials.get("fred_api_key") if credentials else ""
series_ids = ",".join(list(YIELD_CURVES[query.yield_curve_type]))
fetcher = FredSeriesFetcher()
data = await fetcher.fetch_data(
{"symbol": series_ids}, {"fred_api_key": api_key} # type: ignore
)
if not data:
raise EmptyDataError("The request was returned empty.")
results = [d.model_dump() for d in data.result] # type: ignore
return results
@staticmethod
def transform_data(
query: FREDYieldCurveQueryParams, data: list[dict], **kwargs: Any
) -> list[FREDYieldCurveData]:
"""Transform data."""
# pylint: disable=import-outside-toplevel
from pandas import Categorical, DataFrame, DatetimeIndex
df = DataFrame(data).set_index("date").sort_index()
df.index = df.index.astype(str)
dates = query.date.split(",") if query.date else [df.index.max()] # type: ignore
df.index = DatetimeIndex(df.index)
dates_list = DatetimeIndex(dates)
maturity_dict = YIELD_CURVES[query.yield_curve_type]View on GitHub (pinned to 3e071fcc2c)