{"record":{"id":"bc47eb55de16ab6f","repo":"OpenBB-finance/OpenBB","slug":"the-request-was-returned-empty-bc47eb","errorCode":null,"errorMessage":"The request was returned empty.","messagePattern":"The request was returned empty\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/fmp/openbb_fmp/models/revenue_geographic.py","lineNumber":77,"sourceCode":"        # pylint: disable=import-outside-toplevel\n        from openbb_fmp.utils.helpers import get_data_many\n\n        api_key = credentials.get(\"fmp_api_key\") if credentials else \"\"\n        base_url = (\n            \"https://financialmodelingprep.com/stable/revenue-geographic-segmentation?\"\n        )\n        url = f\"{base_url}symbol={query.symbol}&period={query.period}&structure=flat&apikey={api_key}\"\n        return await get_data_many(url, **kwargs)\n\n    @staticmethod\n    def transform_data(\n        query: FMPRevenueGeographicQueryParams,\n        data: list[dict],\n        **kwargs: Any,\n    ) -> list[FMPRevenueGeographicData]:\n        \"\"\"Return the transformed data.\"\"\"\n        if not data:\n            raise EmptyDataError(\"The request was returned empty.\")\n\n        results: list[FMPRevenueGeographicData] = []\n        # We need to flatten the data.\n        for item in data:\n            period_ending = item.get(\"date\")\n            fiscal_year = item.get(\"fiscalYear\")\n            fiscal_period = item.get(\"period\")\n            segment = item.get(\"data\", {})\n\n            for region, revenue_value in segment.items():\n                if revenue_value is not None:\n                    revenue = int(revenue_value) if revenue_value is not None else None\n                    if revenue is not None:\n                        results.append(\n                            FMPRevenueGeographicData.model_validate(\n                                {\n                                    \"period_ending\": period_ending,\n                                    \"fiscal_year\": fiscal_year,","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fmp/openbb_fmp/models/revenue_geographic.py#L59-L95","documentation":"Raised at the top of FMPRevenueGeographicFetch.transform_data when the raw payload list passed to the transformer is empty, i.e. FMP answered with `[]` before any flattening was attempted. It is distinct from the 'Unknown error while transforming' sibling raised at line 104, which fires after flattening yields nothing.","triggerScenarios":"Calling the FMP revenue-geographic-segments endpoint with a symbol that has no geographic breakdown, or with a period parameter (annual/quarter) that has no records; the URL is built as symbol={symbol}&period={period}&structure=flat.","commonSituations":"Symbols without geographic revenue disclosure (common for domestic-only companies), delisted tickers, free-tier keys limited to a subset of companies, or requesting 'quarter' period when only annual segment data exists.","solutions":["Confirm the ticker is valid and listed on a major exchange","Switch query.period between 'annual' and 'quarter' - one may have coverage where the other does not","Test the raw endpoint https://financialmodelingprep.com/api/v4/revenue-geographic-segmentation?symbol=X&period=annual&structure=flat&apikey=KEY to see the empty list first-hand","Fall back to another provider for the revenue_geographic router"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"resp = requests.get(f\"https://financialmodelingprep.com/api/v4/revenue-geographic-segmentation?symbol={symbol}&period={period}&structure=flat&apikey={key}\")\nif not resp.json():\n    raise Skip(f'{symbol} has no geographic segmentation on FMP')","typeGuard":"def is_non_empty_list(data: object) -> bool:\n    return isinstance(data, list) and len(data) > 0","tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\ntry:\n    rows = await obb.economy.revenue_geographic(symbol=symbol, provider='fmp').await_to_list()\nexcept EmptyDataError:\n    rows = []","preventionTips":["Probe the raw FMP endpoint once per symbol and cache which symbols have geographic data","Try both 'annual' and 'quarter' period values","Batch pipelines should catch EmptyDataError per symbol and continue"],"tags":["fmp","revenue","geographic","empty-data"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}