{"record":{"id":"a4a868c5c1c3e9e4","repo":"OpenBB-finance/OpenBB","slug":"the-request-was-returned-empty-this-may-be-due-to-a4a868","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/regional_portfolio_returns.py","lineNumber":138,"sourceCode":"            return get_portfolio_data(\n                dataset=dataset,\n                measure=query.measure,\n                frequency=(None if \"daily\" in dataset.lower() else query.frequency),\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: FamaFrenchRegionalPortfolioReturnsQueryParams,\n        data: tuple,\n        **kwargs: Any,\n    ) -> AnnotatedResult[list[FamaFrenchRegionalPortfolioReturnsData]]:\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        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)\n                )","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/famafrench/openbb_famafrench/models/regional_portfolio_returns.py#L120-L156","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry with default query params (no region filter) to see whether any regional data comes back.","Check that the provider version's regional dataset labels still exist upstream (openbb_famafrench utils helpers).","Inspect the raw zip at the BASE_URL used by download_file to confirm it still contains the expected regional files.","Report a provider bug if the raw file has data but the model returns empty."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    res = obb.economy.famafrench.regional_portfolio_returns()\nexcept OpenBBError as e:\n    if 'returned empty' in str(e):\n        res = None  # no data for this portfolio\n    else:\n        raise","preventionTips":["Fall back to default params when a specific portfolio choice returns empty.","Wrap batch loops so one empty region does not abort the whole job."],"tags":["famafrench","empty-data","regional-portfolios"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}