OpenBB-finance/OpenBB · error · EmptyDataError

The request was returned empty.

Error message

The request was returned empty.

What it means

Raised as EmptyDataError by FMPCurrencyPairs.transform_data when the raw list fetched from FMP's currency-pair endpoint is empty before any processing. The provider treats 'FMP answered but sent zero records' as a terminal condition and surfaces it instead of returning a silently empty list. It is a wrapper around OpenBBError, so it is catchable as either type.

Source

Thrown at openbb_platform/providers/fmp/openbb_fmp/models/currency_pairs.py:70

        """Return the raw data from the FMP endpoint."""
        # pylint: disable=import-outside-toplevel
        from openbb_fmp.utils.helpers import get_data_many

        api_key = credentials.get("fmp_api_key") if credentials else ""
        url = f"https://financialmodelingprep.com/stable/forex-list?apikey={api_key}"

        return await get_data_many(url, **kwargs)

    @staticmethod
    def transform_data(
        query: FMPCurrencyPairsQueryParams, data: list[dict], **kwargs: Any
    ) -> list[FMPCurrencyPairsData]:
        """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["symbol"].str.contains(query.query, case=False)
                | df["fromCurrency"].str.contains(query.query, case=False)
                | df["toCurrency"].str.contains(query.query, case=False)
                | df["fromName"].str.contains(query.query, case=False)
                | df["toName"].str.contains(query.query, case=False)
            ]

        if len(df) == 0:
            raise EmptyDataError(
                f"No results were found with the query supplied. -> {query.query}"
            )
        return [FMPCurrencyPairsData.model_validate(d) for d in df.to_dict("records")]

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Verify the FMP API key: check_creds / PythonInterface credentials, and test the same URL directly with curl (https://financialmodelingprep.com/stable/... + apikey) to see the raw payload
  2. Confirm your FMP subscription plan includes the currency-pairs endpoint
  3. Retry after confirming the endpoint returns data outside OpenBB; if it returns [] there too, the issue is upstream, not in your code
  4. Catch EmptyDataError in the caller and degrade gracefully (cache last good response or fall back to another provider)

Example fix

# before
pairs = await obb.currency.pairs.async_(provider='fmp')

# after
from openbb_core.provider.utils.errors import EmptyDataError
try:
    pairs = await obb.currency.pairs.async_(provider='fmp')
except EmptyDataError:
    pairs = await obb.currency.pairs.async_(provider='another')
Defensive patterns

Strategy: try-catch

Validate before calling

from openbb_core.app.model.obbject import OBB
# No cheap client-side pre-check exists; validate credentials instead
creds = OBB.user.credentials.get('fmp_api_key')
assert creds, 'Set the FMP_API_KEY credential before calling currency pairs'

Type guard

def is_currency_pairs_result(r) -> bool:
    return bool(getattr(r, 'results', None)) and len(r.results) > 0

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
try:
    pairs = await obb.currency.pairs.async_(provider='fmp')
except EmptyDataError:
    pairs = await obb.currency.pairs.async_(provider='polygon')  # or return []

Prevention

When it happens

Trigger: Calling obb.currency.pairs() (provider=fmp) when FMP returns [] for the full FX pair list. Typically caused by an invalid/expired API key, a plan tier that does not include the endpoint, or an upstream outage/empty response from financialmodelingprep.com.

Common situations: Misconfigured FMP_API_KEY credential, free-tier key hitting a paid endpoint, FMP changing/removing the endpoint after a provider update, or a transient empty response during FMP maintenance windows.

Related errors


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