OpenBB-finance/OpenBB · warning · EmptyDataError

The request was returned empty.

Error message

The request was returned empty.

What it means

Raised as EmptyDataError by FMPEquityScreener.transform_data when FMP's company-screener endpoint returned zero rows for the assembled query string. All parameter validation (industry/country/exchange, error 414-416) has already passed; this is FMP itself reporting no matches.

Source

Thrown at openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py:329

            query_dict["country"] = country

        query_str = (
            get_querystring(query_dict, exclude=["query"])
            .replace("True", "true")
            .replace("False", "false")
        )
        base_url = "https://financialmodelingprep.com/stable/company-screener"
        url = f"{base_url}?{query_str}&apikey={api_key}"

        return await get_data(url, **kwargs)  # type: ignore

    @staticmethod
    def transform_data(
        query: FMPEquityScreenerQueryParams, data: list[dict], **kwargs: Any
    ) -> list[FMPEquityScreenerData]:
        """Return the transformed data."""
        if not data:
            raise EmptyDataError("The request was returned empty.")
        return [
            FMPEquityScreenerData.model_validate(d)
            for d in sorted(data, key=lambda x: x["marketCap"], reverse=True)
        ]

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Relax filters one at a time (drop country, then exchange, then industry) until rows return, then re-tighten
  2. Sanity-check numeric filters: mktcap/price min/max must not be inverted or absurd
  3. Verify the key/plan by running the same screener URL directly against FMP
  4. Catch EmptyDataError and show 'no companies matched the criteria' instead of a stack trace

Example fix

# before
res = obb.screener.equity(provider='fmp', country='US', industry='Banking', mktcap_min=10_000_000_000, mktcap_max=1_000)  # inverted -> empty

# after
res = obb.screener.equity(provider='fmp', country='US', industry='Banking', mktcap_min=1_000, mktcap_max=10_000_000_000)
Defensive patterns

Strategy: try-catch

Validate before calling

# sanity-check numeric filters before the call
if mktcap_min is not None and mktcap_max is not None and mktcap_min > mktcap_max:
    raise ValueError('mktcap_min must be <= mktcap_max')

Type guard

null

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
try:
    res = obb.screener.equity(provider='fmp', **filters)
except EmptyDataError:
    filters.pop('exchange', None)  # progressively relax
    res = obb.screener.equity(provider='fmp', **filters)

Prevention

When it happens

Trigger: Calling obb.equity.screener(provider=fmp, ...) with a filter combination that matches no companies - e.g. country='US' + industry='Banking' + marketCap below any listed bank, or mutually exclusive filters (mktcap min > max, country+exchange that never co-occur).

Common situations: Over-constrained screener filters, filter values valid but with empty intersection on FMP's dataset, API key/plan returning an empty payload for the screener endpoint, or FMP data gaps for small markets.

Related errors


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