OpenBB-finance/OpenBB · warning · EmptyDataError

The request was returned empty.

Error message

The request was returned empty.

What it means

Raised in IntrinioCurrencyPairsFetcher.transform_data when the raw list handed back from get_data_many(url, 'pairs') is empty. The currency-pairs endpoint normally returns the full list of supported forex pairs, so an empty payload is unusual and is treated as an empty-data condition via EmptyDataError.

Source

Thrown at openbb_platform/providers/intrinio/openbb_intrinio/models/currency_pairs.py:74

        # pylint: disable=import-outside-toplevel
        from openbb_intrinio.utils.helpers import get_data_many

        api_key = credentials.get("intrinio_api_key") if credentials else ""

        base_url = "https://api-v2.intrinio.com"
        url = f"{base_url}/forex/pairs?api_key={api_key}"
        return await get_data_many(url, "pairs", **kwargs)

    @staticmethod
    def transform_data(
        query: IntrinioCurrencyPairsQueryParams, data: list[dict], **kwargs: Any
    ) -> list[IntrinioCurrencyPairsData]:
        """Return the transformed data."""
        # pylint: disable=import-outside-toplevel
        from pandas import DataFrame

        if not data:
            raise EmptyDataError("The request was returned empty.")
        df = DataFrame(data)
        if query.query:
            df = df[
                df["code"].str.contains(query.query, case=False)
                | df["base_currency"].str.contains(query.query, case=False)
                | df["quote_currency"].str.contains(query.query, case=False)
            ]
        if len(df) == 0:
            raise EmptyDataError(
                f"No results were found with the query supplied. -> {query.query}"
                + " Hint: Names and descriptions are not searchable from Intrinio, try 3-letter symbols."
            )
        return [
            IntrinioCurrencyPairsData.model_validate(d)
            for d in df.to_dict(orient="records")
        ]

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Retry once — transient empty responses happen
  2. Verify the credential can access the forex endpoints: curl 'https://api-v2.intrinio.com/forex/pairs?api_key=<key>'
  3. Inspect the raw response for shape changes (does the JSON still use the 'pairs' key?) and report/update the provider if it changed
  4. Fall back to another provider for currency pairs if available
Defensive patterns

Strategy: retry

Validate before calling

def intrinio_forex_accessible(api_key: str) -> bool:
    import requests
    r = requests.get(f"https://api-v2.intrinio.com/forex/pairs?api_key={api_key}", timeout=10)
    return r.ok and bool(r.json().get("pairs"))

Type guard

from openbb_core.provider.utils.errors import EmptyDataError

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError

for attempt in range(2):
    try:
        pairs = obb.currency.currency_pairs(provider="intrinio").to_df()
        break
    except EmptyDataError:
        if attempt == 1:
            pairs = None  # likely plan/endpoint issue — surface to user
        # one retry covers transient empty responses

Prevention

When it happens

Trigger: The Intrinio /forex/pairs endpoint returns an empty 'pairs' array — e.g. the API product is not enabled for the account, a transient empty response, or an upstream change in the response shape so the 'pairs' key yields nothing.

Common situations: Subscriptions without the Forex API product; schema drift after Intrinio changes the response (key renamed) making get_data_many extract zero records; service degradation returning 200 with empty body.

Related errors


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