OpenBB-finance/OpenBB · error · OpenBBError

[Error] -> {error_str}

Error message

[Error] -> {error_str}

What it means

This is the catch-all of OpenBB's exception decorator for a Pydantic ValidationError raised while validating command parameters or Data models. It re-formats each invalid argument as '[Arg] <location> -> input: <value> -> <message>' lines under a '[Data Model]' or '[Error]' header and re-raises as OpenBBError with the original traceback attached.

Source

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

                                "standard_params",
                                "extra_params",
                                "provider_choices",
                            )
                        ]
                    )
                    msg = err.get("msg", "")
                    _input = (
                        "..."
                        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. Read the '[Arg] <field>' lines in the message to find which parameter failed and correct its value/type
  2. Check the command's parameter schema (obb.coverage / .model_validate) or docs for allowed types and choices
  3. If the error comes from a Data model (prefix '[Data Model] <Name>'), the provider returned malformed data - pin/upgrade the provider package or report the issue
  4. Validate inputs with the command's Params model before calling

Example fix

# before
res = obb.equity.price.historical(symbol=12345, provider='fmp')

# after
res = obb.equity.price.historical(symbol='12345', provider='fmp')
Defensive patterns

Strategy: validation

Validate before calling

from openbb import obb

params = obb.equity.price.historical.__doc__  # inspect signature
# programmatic check via schema:
cmd = 'equity.price.historical'
schema = obb.coverage.commands  # verify parameter types/choices before calling
assert schema.get(cmd), 'unknown command'

Type guard

def valid_symbol(s) -> bool:
    return isinstance(s, str) and s.isalpha() and 1 <= len(s) <= 12

Try / catch

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

try:
    res = obb.equity.price.historical('AAPL', provider='fmp')
except OpenBBError as e:
    msg = str(e)
    if '[Arg]' in msg:
        # parse failing arg lines and fix inputs, then retry or log
        bad = [ln for ln in msg.splitlines() if '[Arg]' in ln]
        raise ValueError(f'bad request params: {bad}') from None
    raise

Prevention

When it happens

Trigger: Calling any @exception_handler-decorated command with a bad parameter value: obb.equity.price.historical(symbol=123, provider='fmp') where symbol must be a str, or a provider fetcher returning rows that fail the standard model's field validation (e.g. date='not-a-date').

Common situations: Passing an int/None where a string is required; passing a provider-specific enum choice not in QueryParams.choices; provider API responses whose fields violate the Data model after a schema change; upstream API format changes breaking date/float coercion.

Related errors


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