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 FamaFrenchUSPortfolioReturns.transform_data when the US portfolios fetch step produced an empty list of DataFrames. The guard is the same `if not dfs` check as the international/regional variants, so the download-or-parse stage yielded nothing for the chosen US portfolio dataset.

Source

Thrown at openbb_platform/providers/famafrench/openbb_famafrench/models/us_portfolio_returns.py:141

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

    @staticmethod
    def transform_data(
        query: FamaFrenchUSPortfolioReturnsQueryParams,
        data: tuple,
        **kwargs: Any,
    ) -> AnnotatedResult[list[FamaFrenchUSPortfolioReturnsData]]:
        """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 a standard dataset (e.g. the default 5 industry portfolios) to isolate the specific portfolio choice.
  2. Validate the dataset label against DATASET_CHOICES in openbb_famafrench/utils/helpers.py.
  3. Fetch the underlying file directly from BASE_URL and confirm it contains data rows.
  4. Update the openbb-famafrench provider package (pip install -U openbb-famafrench) in case the mapping was fixed.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    res = obb.economy.famafrench.us_portfolio_returns(dataset=ds)
except OpenBBError as e:
    if 'returned empty' in str(e):
        continue  # skip this dataset in a batch
    raise

Prevention

When it happens

Trigger: Calling famafrench US portfolio returns with a portfolio/dataset choice that resolves to an empty or unparsable CSV/zip from the Fama/French data library.

Common situations: Portfolio choice mapped to a deprecated dataset label; upstream layout change in the US portfolios zip; tables entirely filtered out because every column is the -99.99/-999 no-data sentinel.

Related errors


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