OpenBB-finance/OpenBB · error · OpenBBError

[Unexpected Error] -> {e.__class__.__name__} -> {e}

Error message

[Unexpected Error] -> {e.__class__.__name__} -> {e}

What it means

The last-resort branch of the exception decorator: the wrapped command raised an exception that is none of ValidationError, UnauthorizedError, EmptyDataError, or OpenBBError - i.e. an unexpected third-party error (KeyError, requests.ConnectionError, JSONDecodeError, provider library bug). It is re-raised as OpenBBError including the original class name and message, with the original traceback attached for debugging.

Source

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

                    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. Note the class name in the message (e.g. 'ConnectionError', 'KeyError') - it identifies the real failure
  2. Set OPENBB_DEBUG_MODE=true and re-run for the full traceback
  3. Upgrade the provider package and openbb-core to matching versions (pip install -U openbb)
  4. If it is a network error, check connectivity/proxy; if a parsing bug, report it to the provider package repo

Example fix

# before
res = obb.equity.price.historical('AAPL', provider='xyz')  # [Unexpected Error] -> KeyError

# after
import openbb
openbb.system.set_debug_mode(True)
res = obb.equity.price.historical('AAPL', provider='xyz')  # full traceback now printed
Defensive patterns

Strategy: try-catch

Try / catch

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

try:
    res = obb.equity.price.historical('AAPL', provider='xyz')
except OpenBBError as e:
    msg = str(e)
    if '[Unexpected Error]' in msg:
        # inspect original class name embedded in message; enable debug for traceback
        openbb.system.set_debug_mode(True) if False else None
        raise
    raise

Prevention

When it happens

Trigger: A provider fetcher hitting a network timeout/SSL error, a KeyError from a malformed provider response, a pandas/numpy error during data transformation, or any bug inside a router extension - all surfacing through a decorated command call.

Common situations: Provider API changed response shape (KeyError/TypeError on parsing); transient network failures; incompatible package versions between openbb-core and a provider; broken proxy/DNS preventing the HTTP call.

Related errors


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