OpenBB-finance/OpenBB · warning · EmptyDataError
The request was returned empty.
Error message
The request was returned empty.
What it means
Raised by FREDCommercialPaperFetch.transform_data when the fetched payload dict is falsy - the FRED series request backing commercial paper rates (CP_SERIES_IDS symbols) returned nothing before the melt/rename pipeline could run. Note the transform then indexes CP_SERIES_IDS by each symbol, so any non-empty but partial payload would instead KeyError.
Source
Thrown at openbb_platform/providers/fred/openbb_fred/models/commercial_paper.py:339
raise e from e
return {
"metadata": response.metadata,
"data": [d.model_dump() for d in response.result],
}
@staticmethod
def transform_data(
query: FREDCommercialPaperParams,
data: dict,
**kwargs: Any,
) -> list[FREDCommercialPaperData]:
"""Transform data."""
# pylint: disable=import-outside-toplevel
from pandas import Categorical, DataFrame
if not data:
raise EmptyDataError("The request was returned empty.")
df = DataFrame(data["data"])
metadata = data.get("metadata", {})
# Flatten data
df = df.melt(id_vars="date", var_name="symbol", value_name="value").query(
"value.notnull()"
)
df = df.rename(columns={"value": "rate"}).sort_values(by="date")
# Normalize percent values
df["rate"] = df["rate"].astype(float) / 100
# Add asset type, maturity, and title
df["asset_type"] = df["symbol"].apply(lambda x: CP_SERIES_IDS[x]["asset"])
df["title"] = df["symbol"].apply(lambda x: CP_SERIES_IDS[x]["title"])
df["maturity"] = df["symbol"].apply(lambda x: CP_SERIES_IDS[x]["maturity"])
# Categorize and order.
asset_type_categories = ["asset_backed", "financial", "nonfinancial", "a2p2"]
maturity_categories = [
"overnight",
"day_7",View on GitHub (pinned to 3e071fcc2c)
Solutions
- Verify the FRED API key is set and valid (test against fred.stlouisfed.org with a simple series like DFF)
- Remove date filters to request full series history
- Check which CP series in CP_SERIES_IDS are still published on FRED and whether your window predates/postdates them
- Retry after a minute if FRED throttled the request
Defensive patterns
Strategy: validation
Validate before calling
import os, requests
key = os.environ.get('FRED_API_KEY')
assert key, 'FRED_API_KEY not set'
r = requests.get(f'https://api.stlouisfed.org/fred/series/observations?series_id=CPFF&api_key={key}&file_type=json')
assert r.status_code == 200 and r.json().get('observations'), 'FRED key or series invalid' 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:
obs = await obb.fixedincome.commercial_paper(provider='fred', start_date=s, end_date=e).await_to_list()
except EmptyDataError:
obs = [] Prevention
- Validate the FRED API key at startup with a cheap known series
- Check which CP series tenors are still published - several were discontinued
- Remove date filters on discovery calls to confirm series liveness
When it happens
Trigger: FRED returning {} for the commercial paper series request - invalid/expired FRED API key producing an empty structure, or a complete failure of the underlying multi-series fetch with no observations for the date window.
Common situations: Misconfigured FRED_API_KEY (empty-key requests can yield empty bodies rather than explicit errors); date windows outside the CP series' coverage (some tenors were discontinued in 2020); FRED request throttling.
Related errors
- No data returned for the given symbols.
- The request was returned empty.
- No data was returned from the FMP endpoint.
- The request was returned with no data.
- No data was found for, {query.country}.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/c7a9187449b58d90.
Report an issue: GitHub.