{"record":{"id":"3d382cc9823b2e92","repo":"OpenBB-finance/OpenBB","slug":"the-request-was-returned-empty-this-may-be-due-to-3d382c","errorCode":null,"errorMessage":"The request was returned empty. This may be due to an invalid, or incorrectly mapped, portfolio choice.","messagePattern":"The request was returned empty\\. This may be due to an invalid, or incorrectly mapped, portfolio choice\\.","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/famafrench/openbb_famafrench/models/us_portfolio_returns.py","lineNumber":141,"sourceCode":"                    None\n                    if \"daily\" in dataset.lower() or \"weekly\" in dataset.lower()\n                    else query.frequency\n                ),\n            )\n        except Exception as e:  # pylint: disable=broad-except\n            raise OpenBBError(e) from e\n\n    @staticmethod\n    def transform_data(\n        query: FamaFrenchUSPortfolioReturnsQueryParams,\n        data: tuple,\n        **kwargs: Any,\n    ) -> AnnotatedResult[list[FamaFrenchUSPortfolioReturnsData]]:\n        \"\"\"Transform the extracted data.\"\"\"\n        dfs, meta = data\n\n        if not dfs:\n            raise OpenBBError(\n                \"The request was returned empty.\"\n                + \" This may be due to an invalid, or incorrectly mapped, portfolio choice.\"\n            )\n\n        returns_data = dfs[0] if isinstance(dfs, list) else dfs\n\n        # Values of -99.99  or -999 indicate no data,\n        # Drop columns that have no data.\n        for col in returns_data.columns:\n            if all(returns_data[col].values == \"-99.99\") or all(\n                returns_data[col].values == \"-999\"\n            ):\n                returns_data = returns_data.drop(columns=[col])\n            else:\n                returns_data[col] = (\n                    returns_data[col].astype(int)\n                    if query.measure == \"number_of_firms\"\n                    else returns_data[col].astype(float)","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/famafrench/openbb_famafrench/models/us_portfolio_returns.py#L123-L159","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry with a standard dataset (e.g. the default 5 industry portfolios) to isolate the specific portfolio choice.","Validate the dataset label against DATASET_CHOICES in openbb_famafrench/utils/helpers.py.","Fetch the underlying file directly from BASE_URL and confirm it contains data rows.","Update the openbb-famafrench provider package (pip install -U openbb-famafrench) in case the mapping was fixed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    res = obb.economy.famafrench.us_portfolio_returns(dataset=ds)\nexcept OpenBBError as e:\n    if 'returned empty' in str(e):\n        continue  # skip this dataset in a batch\n    raise","preventionTips":["Validate dataset labels against DATASET_CHOICES before the call.","In batch pipelines, catch and skip empty datasets instead of failing the run."],"tags":["famafrench","empty-data","us-portfolios"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}