OpenBB-finance/OpenBB · error · OpenBBError

{str(e) or 'FRED request failed ({type(e).__name__}).'}

Error message

{str(e) or 'FRED request failed ({type(e).__name__}).'}

What it means

The generic wrapper in FredSeriesFetcher.aextract_data (openbb_fred/models/series.py:195): any exception raised while fetching the requested series (network error, JSON decode error, unexpected provider error) that is not itself an OpenBBError is re-raised as OpenBBError(str(e)), preserving the original as __cause__. Note that gather runs with return_exceptions=True and each exception is immediately re-raised, so the first failing series ID aborts the whole multi-symbol request.

Source

Thrown at openbb_platform/providers/fred/openbb_fred/models/series.py:195

                    "data": data,
                }
            }

        try:
            results: list[dict] = []
            for result in await asyncio.gather(
                *[fetch_one(sid) for sid in series_ids], return_exceptions=True
            ):
                if isinstance(result, Exception):
                    raise result
                if result:
                    results.append(result)  # type: ignore
            return results
        except OpenBBError:
            raise
        except Exception as e:
            message = str(e) or f"FRED request failed ({type(e).__name__})."
            raise OpenBBError(message) from e

    @staticmethod
    def transform_data(
        query: FredSeriesQueryParams, data: list[dict], **kwargs: Any
    ) -> AnnotatedResult[list[FredSeriesData]]:
        """Transform data."""
        # pylint: disable=import-outside-toplevel
        from pandas import DataFrame  # noqa
        from numpy import nan

        series = {_id: s.pop("data", {}) for d in data for _id, s in d.items()}
        metadata = {_id: m for d in data for _id, m in d.items()}
        records = (
            DataFrame(series)
            .filter(items=query.symbol.split(","), axis=1)
            .sort_index()
            .reset_index()
            .rename(columns={"index": "date"})

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Read the wrapped message - it is the original exception's text and names the real cause.
  2. Split multi-symbol requests into per-symbol calls so one bad ID does not abort the rest.
  3. For network errors, retry with exponential backoff; verify reachability of api.stlouisfed.org.
  4. Validate each symbol exists with fred_search(query=symbol) before the batch fetch.

Example fix

# before - one bad symbol aborts everything
obb.economy.fred.series(symbol='GDP,CPIAUCSL,BADID')

# after - isolate failures per symbol
for sym in ['GDP', 'CPIAUCSL', 'BADID']:
    try:
        obb.economy.fred.series(symbol=sym)
    except OpenBBError as e:
        print(f'{sym} failed: {e}')
Defensive patterns

Strategy: try-catch

Try / catch

from openbb_core.app.model.abstract.error import OpenBBError

results = {}
for sym in symbols:  # per-symbol isolation; one bad ID no longer kills the batch
    try:
        results[sym] = obb.economy.fred.series(symbol=sym, **params)
    except OpenBBError as e:
        print(f'{sym}: {e.__cause__ or e}')  # original exception preserved via __cause__
        continue

Prevention

When it happens

Trigger: One invalid/discontinued symbol in a comma-separated symbol list (underlying error then wrapped here); connection resets/timeouts to api.stlouisfed.org; malformed JSON from a proxy; pandas/date parsing errors on malformed observations.

Common situations: Batch-fetching many symbols where a single bad ID kills the batch; running behind corporate proxies that alter TLS responses; intermittent network drops during large historical pulls.

Related errors


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