OpenBB-finance/OpenBB · warning · OpenBBError

The request was returned empty. This may be due to an invali

Error message

The request was returned empty. This may be due to an invalid, or incorrectly mapped, portfolio choice.

What it means

Thrown by FamaFrenchRegionalPortfolioReturns.transform_data when the regional portfolios fetcher returned zero DataFrames. Identical guard to the other Fama/French return models: `if not dfs: raise OpenBBError(...)`. Means the download succeeded (or returned nothing parseable) but no regional portfolio tables survived processing.

Source

Thrown at openbb_platform/providers/famafrench/openbb_famafrench/models/regional_portfolio_returns.py:138

            return get_portfolio_data(
                dataset=dataset,
                measure=query.measure,
                frequency=(None if "daily" in dataset.lower() else query.frequency),
            )
        except Exception as e:  # pylint: disable=broad-except
            raise OpenBBError(e) from e

    @staticmethod
    def transform_data(
        query: FamaFrenchRegionalPortfolioReturnsQueryParams,
        data: tuple,
        **kwargs: Any,
    ) -> AnnotatedResult[list[FamaFrenchRegionalPortfolioReturnsData]]:
        """Transform the extracted data."""
        dfs, meta = data

        if not dfs:
            raise OpenBBError(
                "The request was returned empty."
                + " This may be due to an invalid, or incorrectly mapped, portfolio choice."
            )
        returns_data = dfs[0] if isinstance(dfs, list) else dfs

        # Values of -99.99  or -999 indicate no data,
        # Drop columns that have no data.
        for col in returns_data.columns:
            if all(returns_data[col].values == "-99.99") or all(
                returns_data[col].values == "-999"
            ):
                returns_data = returns_data.drop(columns=[col])
            else:
                returns_data[col] = (
                    returns_data[col].astype(int)
                    if query.measure == "number_of_firms"
                    else returns_data[col].astype(float)
                )

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Retry with default query params (no region filter) to see whether any regional data comes back.
  2. Check that the provider version's regional dataset labels still exist upstream (openbb_famafrench utils helpers).
  3. Inspect the raw zip at the BASE_URL used by download_file to confirm it still contains the expected regional files.
  4. Report a provider bug if the raw file has data but the model returns empty.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    res = obb.economy.famafrench.regional_portfolio_returns()
except OpenBBError as e:
    if 'returned empty' in str(e):
        res = None  # no data for this portfolio
    else:
        raise

Prevention

When it happens

Trigger: Calling the famafrench regional portfolio returns endpoint for a region/portfolio combination whose CSV tables parse to an empty list, or when the dataset zip is empty upstream.

Common situations: Region label that no longer matches an upstream file after a provider update; upstream CSV format change that makes read_csv_file drop all rows; all-sentinel (-99.99/-999) columns causing every table to be discarded.

Related errors


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