OpenBB-finance/OpenBB · error · OpenBBError

{messages}

Error message

{messages}

What it means

OpenBBError raised in the IntrinioEtfSearchFetcher response callback when the /etfs/search (or /etfs) response contains a non-empty 'messages' key. Intrinio uses 'messages' for advisory/error notices, and the fetcher stringifies the entire list and re-raises it, losing structure but preserving the text.

Source

Thrown at openbb_platform/providers/intrinio/openbb_intrinio/models/etf_search.py:107

        api_key = credentials.get("intrinio_api_key") if credentials else ""
        BASE = "https://api-v2.intrinio.com/etfs"
        if query.exchange is not None:
            url = f"{BASE}?exchange={query.exchange.upper()}&page_size=10000&api_key={api_key}"
        elif query.query:
            url = f"{BASE}/search?query={query.query}&page_size=10000&api_key={api_key}"
        else:
            url = f"{BASE}?page_size=10000&api_key={api_key}"

        data: list = []

        async def response_callback(response: ClientResponse, session: ClientSession):
            """Async response callback."""
            results = await response.json()

            if results.get("messages"):  # type: ignore
                messages = results.get("messages")  # type: ignore
                raise OpenBBError(str(messages))

            if results.get("etfs") and len(results.get("etfs")) > 0:  # type: ignore
                data.extend(results.get("etfs"))  # type: ignore
                while results.get("next_page"):  # type: ignore
                    next_page = results["next_page"]  # type: ignore
                    next_url = f"{url}&next_page={next_page}"
                    results = await amake_request(next_url, session=session, **kwargs)
                    if "etfs" in results and len(results.get("etfs")) > 0:  # type: ignore
                        data.extend(results.get("etfs"))  # type: ignore
            return data

        return await amake_request(url, response_callback=response_callback, **kwargs)  # type: ignore

    @staticmethod
    def transform_data(
        query: IntrinioEtfSearchQueryParams,
        data: list[dict],
        **kwargs: Any,

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Read the str(messages) content — it is Intrinio's own notice and names the problem
  2. If it mentions your key/subscription, set obb.account.credentials.intrinio_api_key correctly or upgrade the plan
  3. Sanitize the query parameter (strip/encode special characters) before sending
Defensive patterns

Strategy: try-catch

Validate before calling

from urllib.parse import quote

def clean_search_query(q: str) -> str:
    return quote(q.strip()) if q and q.strip() else ""

Type guard

from openbb_core.provider.abstract.error import OpenBBError

def is_intrinio_messages_error(err: BaseException) -> bool:
    return isinstance(err, OpenBBError) and (str(err).startswith("[") or str(err).startswith("("))

Try / catch

from openbb_core.provider.abstract.error import OpenBBError

try:
    res = await obb.etf.search(provider="intrinio", query=q)
except OpenBBError as e:
    if "api key" in str(e).lower():
        raise RuntimeError("fix intrinio_api_key") from e
    log.warning("etf search rejected query %r: %s", q, e)
    res = None

Prevention

When it happens

Trigger: Any ETF search request where Intrinio attaches messages: invalid API key phrased as a message, restricted endpoint access, or malformed query parameters. Trigger is results.get('messages') being truthy on the first page of the response.

Common situations: Missing/expired intrinio_api_key on first use; free-tier key hitting the ETF search product; query strings with characters the API rejects (unencoded special characters in query.query).

Related errors


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