{"record":{"id":"9dee3a642a37e8aa","repo":"OpenBB-finance/OpenBB","slug":"unknown-error-while-transforming-the-data-9dee3a","errorCode":null,"errorMessage":"Unknown error while transforming the data.","messagePattern":"Unknown error while transforming the data\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/fmp/openbb_fmp/models/revenue_geographic.py","lineNumber":104,"sourceCode":"\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,\n                                    \"fiscal_period\": fiscal_period,\n                                    \"region\": region.replace(\"Segment\", \"\").strip(),\n                                    \"revenue\": revenue,\n                                }\n                            )\n                        )\n\n        if not results:\n            raise EmptyDataError(\"Unknown error while transforming the data.\")\n\n        return sorted(results, key=lambda x: (x.period_ending or \"\", x.revenue or 0))\n","sourceCodeStart":86,"sourceCodeEnd":107,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fmp/openbb_fmp/models/revenue_geographic.py#L86-L107","documentation":"Raised at the end of FMPRevenueGeographicFetch.transform_data when the flattening loop (iterating each period's 'data' dict of region->revenue) appended nothing, so `results` is empty. The API returned periods, but every region value was None or the segment dicts were empty. Sister of error 441, which fires when the raw list itself was empty.","triggerScenarios":"FMP returns rows like {'date': '2023-12-31', 'data': {'unitedStates': None, 'canada': None}} where all segment values are null, so `if revenue_value is not None` filters out every entry.","commonSituations":"Companies whose geographic segmentation is reported but nulled out in FMP's dataset; partially-covered symbols on lower subscription tiers; periods early in a company's history before segment reporting began.","solutions":["Inspect the raw FMP response to see whether segment values are null vs missing","Narrow the date range to recent fiscal years where segment reporting is complete","Try provider alternatives or the business-line endpoint, which may have coverage where geographic does not","If the response is a premium-tier message instead of nulls, upgrade the FMP key tier"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"rows = requests.get(f\"{url}&apikey={key}\").json()\nany_values = any(any(v is not None for v in r.get('data', {}).values()) for r in rows)","typeGuard":"def has_non_null_segments(data: list[dict]) -> bool:\n    return any(\n        any(v is not None for v in item.get(\"data\", {}).values())\n        for item in data\n    )","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 as e:\n    if 'transforming' in str(e):\n        rows = []  # segments exist but are all null - skip or fall back\n    else:\n        raise","preventionTips":["Distinguish the two EmptyDataError variants by message text to route handling","Restrict date ranges to fiscal years with complete segment reporting","Cache known-no-coverage symbols to avoid repeated failing calls"],"tags":["fmp","revenue","geographic","empty-data","transform"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}