{"record":{"id":"555b2aa3f92d734f","repo":"OpenBB-finance/OpenBB","slug":"the-request-was-returned-empty-555b2a","errorCode":null,"errorMessage":"The request was returned empty.","messagePattern":"The request was returned empty\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/fmp/openbb_fmp/models/currency_pairs.py","lineNumber":70,"sourceCode":"        \"\"\"Return the raw data from the FMP endpoint.\"\"\"\n        # 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        url = f\"https://financialmodelingprep.com/stable/forex-list?apikey={api_key}\"\n\n        return await get_data_many(url, **kwargs)\n\n    @staticmethod\n    def transform_data(\n        query: FMPCurrencyPairsQueryParams, data: list[dict], **kwargs: Any\n    ) -> list[FMPCurrencyPairsData]:\n        \"\"\"Return the transformed data.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from pandas import DataFrame\n\n        if not data:\n            raise EmptyDataError(\"The request was returned empty.\")\n\n        df = DataFrame(data)\n\n        if query.query:\n            df = df[\n                df[\"symbol\"].str.contains(query.query, case=False)\n                | df[\"fromCurrency\"].str.contains(query.query, case=False)\n                | df[\"toCurrency\"].str.contains(query.query, case=False)\n                | df[\"fromName\"].str.contains(query.query, case=False)\n                | df[\"toName\"].str.contains(query.query, case=False)\n            ]\n\n        if len(df) == 0:\n            raise EmptyDataError(\n                f\"No results were found with the query supplied. -> {query.query}\"\n            )\n        return [FMPCurrencyPairsData.model_validate(d) for d in df.to_dict(\"records\")]\n","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fmp/openbb_fmp/models/currency_pairs.py#L52-L88","documentation":"Raised as EmptyDataError by FMPCurrencyPairs.transform_data when the raw list fetched from FMP's currency-pair endpoint is empty before any processing. The provider treats 'FMP answered but sent zero records' as a terminal condition and surfaces it instead of returning a silently empty list. It is a wrapper around OpenBBError, so it is catchable as either type.","triggerScenarios":"Calling obb.currency.pairs() (provider=fmp) when FMP returns [] for the full FX pair list. Typically caused by an invalid/expired API key, a plan tier that does not include the endpoint, or an upstream outage/empty response from financialmodelingprep.com.","commonSituations":"Misconfigured FMP_API_KEY credential, free-tier key hitting a paid endpoint, FMP changing/removing the endpoint after a provider update, or a transient empty response during FMP maintenance windows.","solutions":["Verify the FMP API key: check_creds / PythonInterface credentials, and test the same URL directly with curl (https://financialmodelingprep.com/stable/... + apikey) to see the raw payload","Confirm your FMP subscription plan includes the currency-pairs endpoint","Retry after confirming the endpoint returns data outside OpenBB; if it returns [] there too, the issue is upstream, not in your code","Catch EmptyDataError in the caller and degrade gracefully (cache last good response or fall back to another provider)"],"exampleFix":"# before\npairs = await obb.currency.pairs.async_(provider='fmp')\n\n# after\nfrom openbb_core.provider.utils.errors import EmptyDataError\ntry:\n    pairs = await obb.currency.pairs.async_(provider='fmp')\nexcept EmptyDataError:\n    pairs = await obb.currency.pairs.async_(provider='another')","handlingStrategy":"try-catch","validationCode":"from openbb_core.app.model.obbject import OBB\n# No cheap client-side pre-check exists; validate credentials instead\ncreds = OBB.user.credentials.get('fmp_api_key')\nassert creds, 'Set the FMP_API_KEY credential before calling currency pairs'","typeGuard":"def is_currency_pairs_result(r) -> bool:\n    return bool(getattr(r, 'results', None)) and len(r.results) > 0","tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\ntry:\n    pairs = await obb.currency.pairs.async_(provider='fmp')\nexcept EmptyDataError:\n    pairs = await obb.currency.pairs.async_(provider='polygon')  # or return []","preventionTips":["Keep a health-check call (one cheap FMP endpoint) at app startup to detect dead keys early","Wrap provider calls in a helper that maps EmptyDataError to an empty-domain result","Monitor FMP status/plan limits when upgrading the openbb-fmp package"],"tags":["fmp","empty-data","currency","api-key"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}