OpenBB-finance/OpenBB · warning · EmptyDataError
The request was returned empty.
Error message
The request was returned empty.
What it means
Raised by FredBondIndicesFetch.transform_data when the fetched payload dict itself is falsy - the multi-series FRED extraction returned nothing at all before the DataFrame was built. Sister check at line 573 catches a non-empty payload whose 'data' records list is empty.
Source
Thrown at openbb_platform/providers/fred/openbb_fred/models/bond_indices.py:570
temp = await FredSeriesFetcher.fetch_data(item_query, credentials)
result = [d.model_dump() for d in temp.result]
results["metadata"] = temp.metadata
results["data"] = result
return results
@staticmethod
def transform_data(
query: FredBondIndicesQueryParams,
data: dict,
**kwargs: Any,
) -> AnnotatedResult[list[FredBondIndicesData]]:
"""Transform data."""
# pylint: disable=import-outside-toplevel
from pandas import Categorical, DataFrame
if not data:
raise EmptyDataError("The request was returned empty.")
df = DataFrame.from_records(data["data"])
if df.empty:
raise EmptyDataError(
"No data found for the given query. Try adjusting the parameters."
)
# Flatten the data as a pivot table.
df = (
df.melt(id_vars="date", var_name="symbol", value_name="value")
.query("value.notnull()")
.set_index(["date", "symbol"])
.sort_index()
.reset_index()
)
# Normalize the percent values.
if query.index_type != "total_return":
df["value"] = df["value"] / 100
titles_dict = {View on GitHub (pinned to 3e071fcc2c)
Solutions
- Widen or remove start_date/end_date to the full history
- Verify the mapped symbols exist on fred.stlouisfed.org
- Retry after a minute if FRED rate-limited the multi-series request
- Check the FRED API key is valid (invalid keys usually error earlier, but partial-auth states can return empty)
Defensive patterns
Strategy: try-catch
Validate before calling
raw = await fetch_fred_series_series(mapped_symbols, start_date, end_date) assert raw, 'FRED returned an empty payload - check key and date range'
Type guard
def is_non_empty_payload(payload: object) -> bool:
return isinstance(payload, dict) and len(payload) > 0 Try / catch
from openbb_core.provider.utils.errors import EmptyDataError
try:
rows = await obb.economy.bond_indices(provider='fred', **params).await_to_list()
except EmptyDataError:
rows = [] # retry with wider window Prevention
- Verify the mapped BAML symbols exist on FRED before bulk queries
- Avoid restrictive date filters on first discovery calls
- Rate-limit FRED requests to prevent throttled empty responses
When it happens
Trigger: The FRED series API call for the mapped BAML symbols returned an empty dict - typically when none of the symbols exist for the user's date parameters or the request failed upstream and returned {}.
Common situations: Date ranges outside FRED coverage for the chosen bond index series; FRED API throttling returning an empty structure; transformation kwargs (aggregation_method, transform) that eliminate all observations.
Related errors
- No data found for the given query. Try adjusting the paramet
- The request was returned with no data.
- No data was found for, {query.country}.
- No valid combinations of parameters were found. {','.join(me
- Error mapping the provided choices to series ID. {','.join(m
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/460b42fdceeeee9e.
Report an issue: GitHub.