{"record":{"id":"ae94e83bfb704ad9","repo":"OpenBB-finance/OpenBB","slug":"fmp-error-message-status-code-response-status","errorCode":null,"errorMessage":"FMP Error Message -> Status code: {response.status} -> {error_message}","messagePattern":"FMP Error Message -> Status code: (.+?) -> (.+?)","errorType":"http","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/fmp/openbb_fmp/utils/helpers.py","lineNumber":38,"sourceCode":"\n    if isinstance(data, dict):\n        error_message = data.get(\"Error Message\", data.get(\"error\"))\n\n        if error_message is not None:\n            conditions = (\n                \"upgrade\" in error_message.lower()\n                or \"exclusive endpoint\" in error_message.lower()\n                or \"special endpoint\" in error_message.lower()\n                or \"premium query parameter\" in error_message.lower()\n                or \"subscription\" in error_message.lower()\n                or \"unauthorized\" in error_message.lower()\n                or \"premium\" in error_message.lower()\n            )\n\n            if conditions:\n                raise UnauthorizedError(f\"Unauthorized FMP request -> {error_message}\")\n\n            raise OpenBBError(\n                f\"FMP Error Message -> Status code: {response.status} -> {error_message}\"\n            )\n\n    return data\n\n\nasync def get_data(url: str, **kwargs: Any) -> list | dict:\n    \"\"\"Get data from FMP endpoint.\"\"\"\n    # pylint: disable=import-outside-toplevel\n    from openbb_core.provider.utils.helpers import amake_request\n\n    return await amake_request(url, response_callback=response_callback, **kwargs)\n\n\nasync def get_data_urls(urls: list[str], **kwargs: Any) -> list | dict:\n    \"\"\"Get data from FMP for several urls.\"\"\"\n    # pylint: disable=import-outside-toplevel\n    from openbb_core.provider.utils.helpers import amake_requests","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fmp/openbb_fmp/utils/helpers.py#L20-L56","documentation":"Raised in FMP's response_callback when the body contains an 'Error Message'/'error' field that does NOT match any of the authorization keywords checked above it - i.e. FMP returned 200 with a genuine error payload that is not plan-related. The generic OpenBBError preserves the status code and the server's error text.","triggerScenarios":"FMP-side errors such as 'Invalid symbol', malformed query values the API rejects post-200, or dataset-specific failures (e.g. 'No data available for this time range') delivered as a 200 JSON error dict.","commonSituations":"Passing an unknown/delisted ticker or a symbol suffix FMP does not recognize; malformed dates; transient FMP data-pipeline errors that arrive as error JSON rather than status codes.","solutions":["Read the embedded error_message verbatim - it comes straight from FMP and names the real problem","Validate the symbol exists via FMP's symbol search before querying data endpoints","Normalize date formats to YYYY-MM-DD as FMP expects","Retry after a short delay if the message suggests a transient data issue"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import requests\nr = requests.get(f\"https://financialmodelingprep.com/stable/search-ticker?query={symbol}&apikey={key}\")\nassert r.status_code == 200 and r.json(), f'{symbol} not found on FMP'","typeGuard":null,"tryCatchPattern":"from openbb_core.app.model.abstract.error import OpenBBError\ntry:\n    data = await fetcher.fetch_data(query, credentials)\nexcept OpenBBError as e:\n    if 'FMP Error Message' in str(e):\n        log.warning('FMP rejected query %s: %s', query, e)\n    raise","preventionTips":["Validate symbols against FMP's ticker search before data calls","Normalize all date parameters to YYYY-MM-DD","Log the embedded server error text verbatim - it names the actual cause"],"tags":["fmp","api-error","invalid-symbol"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}