OpenBB-finance/OpenBB · error · OpenBBError

Failed to get futures curve -> {e.__class__.__name__ if hasa

Error message

Failed to get futures curve -> {e.__class__.__name__ if hasattr(e, '__class__') else e}: {e.args}

What it means

The async fetch_data entry point wraps its entire body in a try/except and re-raises any failure as OpenBBError with the original exception's class name and args appended. This is a catch-all wrapper: the real cause is in the message (network timeout, HTTP error from Deribit, a parsing error in get_futures_curve_by_hours_ago, etc.). The 'from e' preserves the original as __cause__ for introspection.

Source

Thrown at openbb_platform/providers/deribit/openbb_deribit/models/futures_curve.py:142

            if query.hours_ago is not None:
                num_hours = query.hours_ago

                hours_ago = (
                    [int(d) for d in num_hours.split(",")]
                    if isinstance(num_hours, str)
                    else [int(num_hours)] if isinstance(num_hours, int) else num_hours
                )

                for hours in hours_ago:
                    hours_data = await get_futures_curve_by_hours_ago(
                        query.symbol, hours
                    )
                    if hours_data:
                        data.extend(hours_data)
            return data
        except Exception as e:  # pylint: disable=broad-except
            raise OpenBBError(
                f"Failed to get futures curve -> {e.__class__.__name__ if hasattr(e, '__class__') else e}: {e.args}"
            ) from e

    @staticmethod
    def transform_data(
        query: DeribitFuturesCurveQueryParams, data: list, **kwargs: Any
    ) -> list[DeribitFuturesCurveData]:
        """Transform the data."""
        # pylint: disable=import-outside-toplevel
        from datetime import datetime  # noqa
        from pandas import to_datetime

        if not data:
            raise EmptyDataError("No data found")

        futures_curve: list[DeribitFuturesCurveData] = []

        for d in data:

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Inspect e.__cause__ / the exception class in the message to identify the real failure
  2. For network causes, retry with backoff; Deribit's public API is generally reliable but geo-restrictions apply
  3. For parsing causes, update the openbb_deribit package to the latest version (pip install -U openbb-deribit)

Example fix

# before
try:
    data = await DeribitFuturesCurveFetcher.fetch_data(q, {})  # opaque 'Failed to get futures curve -> ...'
except OpenBBError:
    raise

# after
try:
    data = await DeribitFuturesCurveFetcher.fetch_data(q, {})
except OpenBBError as e:
    cause = e.__cause__
    if isinstance(cause, (ConnectionError, TimeoutError)):
        await asyncio.sleep(2 ** attempt)
        continue  # retry with backoff
    raise
Defensive patterns

Strategy: retry

Try / catch

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

for attempt in range(3):
    try:
        result = await fetcher.fetch_data(query, {})
        break
    except OpenBBError as e:
        cause = e.__cause__
        if isinstance(cause, (TimeoutError, ConnectionError)) and attempt < 2:
            await asyncio.sleep(2 ** attempt)
            continue
        raise

Prevention

When it happens

Trigger: Deribit API unreachable (DNS/proxy/firewall); Deribit returning an unexpected payload shape that breaks parsing; rate-limited or 5xx responses inside get_futures_curve_by_hours_ago; an invalid expiry parsing in instrument names.

Common situations: Corporate egress blocking api.deribit.com; transient Deribit outages; schema drift when Deribit changes instrument naming; running in regions where Deribit is blocked.

Related errors


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