OpenBB-finance/OpenBB · warning · EmptyDataError

[Empty] -> {e}

Error message

[Empty] -> {e}

What it means

Raised when the wrapped command raised EmptyDataError - the provider fetch succeeded but returned zero rows for the request. The decorator prefixes '[Empty] ->' and re-raises EmptyDataError with the original traceback so callers can handle 'no data' distinctly from hard errors.

Source

Thrown at openbb_platform/core/openbb_core/app/static/utils/decorators.py:98

                        "..."
                        if msg == "Missing required argument"
                        else err.get("input", "")
                    )
                    prefix = f"[Data Model] {e.title}\n" if "Data" in e.title else ""
                    error_list.append(
                        f"{prefix}[Arg] {loc} -> input: {_input} -> {msg}"
                    )
                error_list.insert(0, validation_error)
                error_str = "\n".join(error_list)
                raise OpenBBError(f"\n[Error] -> {error_str}").with_traceback(
                    tb
                ) from None
            if isinstance(e, UnauthorizedError):
                raise UnauthorizedError(f"\n[Error] -> {e}").with_traceback(
                    tb
                ) from None
            if isinstance(e, EmptyDataError):
                raise EmptyDataError(f"\n[Empty] -> {e}").with_traceback(tb) from None
            if isinstance(e, OpenBBError):
                raise OpenBBError(f"\n[Error] -> {e}").with_traceback(tb) from None
            if isinstance(e, Exception):
                raise OpenBBError(
                    f"\n[Unexpected Error] -> {e.__class__.__name__} -> {e}"
                ).with_traceback(tb) from None

        return None

    return wrapper

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Verify the symbol exists and is covered by the chosen provider
  2. Widen or correct the date range / filters so at least one record matches
  3. Catch EmptyDataError and treat it as an empty result rather than a failure in downstream code
  4. Try a different provider that covers the instrument

Example fix

# before
try:
    res = obb.equity.price.historical('BRK.A')
except Exception as e:
    raise  # any error looks the same

# after
from openbb_core.app.model.empty_error import EmptyDataError
try:
    res = obb.equity.price.historical('BRK-A')
except EmptyDataError:
    res = None  # no data, handle gracefully
Defensive patterns

Strategy: try-catch

Validate before calling

def range_has_sessions(start, end) -> bool:
    """Rough guard: at least one weekday between the dates."""
    import pandas as pd
    days = pd.bdate_range(start, end)
    return len(days) > 0

Try / catch

from openbb_core.provider.abstract.error import EmptyDataError

try:
    res = obb.equity.price.historical('AAPL', start_date='2024-01-01')
except EmptyDataError:
    res = None  # no data for this request - not a failure

Prevention

When it happens

Trigger: Querying a symbol/date range with no data: obb.equity.price.historical('INVALID', start_date='2075-01-01'); a ticker delisted before the requested range; a provider legitimately having no records for the filters given.

Common situations: Misspelled ticker; date range outside the symbol's listing history; weekend/holiday-only range for daily data; filters (e.g. market cap thresholds) excluding all rows; provider coverage gaps for small-cap or foreign symbols.

Related errors


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