{"record":{"id":"f9c95bd65995d25b","repo":"OpenBB-finance/OpenBB","slug":"no-data-found-for-id-replace","errorCode":null,"errorMessage":"No data found for {_id.replace('%', '')}.","messagePattern":"No data found for (.+?)\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/cftc/openbb_cftc/models/cot.py","lineNumber":1926,"sourceCode":"                f\"OR UPPER(cftc_contract_market_code) like UPPER('{_id}') \"\n                f\"OR UPPER(commodity_group_name) like UPPER('{_id}') \"\n                f\"OR UPPER(commodity_subgroup_name) like UPPER('{_id}'))\"\n            )\n            if _id\n            else base_url\n        )\n        url = f\"{url}{order}\"\n\n        if app_token:\n            url += f\"&$$app_token={app_token}\"\n\n        try:\n            response = await amake_request(url, **kwargs)\n        except OpenBBError as error:\n            raise error from error\n\n        if not response:\n            raise EmptyDataError(f\"No data found for {_id.replace('%', '')}.\")\n\n        return response  # type: ignore\n\n    @staticmethod\n    def transform_data(\n        query: CftcCotQueryParams,\n        data: list[dict],\n        **kwargs: Any,\n    ) -> list[CftcCotData]:\n        \"\"\"Transform and validate the data.\"\"\"\n        response = data.copy()\n        string_cols = [\n            \"market_and_exchange_names\",\n            \"cftc_contract_market_code\",\n            \"cftc_market_code\",\n            \"cftc_region_code\",\n            \"cftc_commodity_code\",\n            \"cftc_contract_market_code_quotes\",","sourceCodeStart":1908,"sourceCodeEnd":1944,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/cftc/openbb_cftc/models/cot.py#L1908-L1944","documentation":"EmptyDataError from the CFTC Commitments of Traders fetcher (cot.py:1926) when the Socrata-style CFTC API returns a falsy/empty response for the constructed report URL. The message echoes the requested dataset id (with %20 encoding stripped) so you can see which report series came back empty. It signals 'the API answered but had zero records for this query', not a network failure.","triggerScenarios":"Requesting a CoT report id that does not exist or is discontinued; a combination of id/report_type/format/granularity that matches zero rows (e.g. a future with no data for that time frame); asking for a current report before the CFTC has published it (reports lag by days); Socrata returning [] due to a malformed $order or filter appended to the URL.","commonSituations":"Typos in dataset ids taken from URLs (e.g. clipped '20%20Futures' strings); new asset classes the CFTC does not cover; scripts run on Friday expecting the Friday report before publication cutoff; CFTC re-issuing Socrata dataset ids after site migrations.","solutions":["Verify the report id exists in cot_search (the CFTC search endpoint) and copy the exact id string.","If asking for the latest report, add a date fallback: request the prior week when today's publication is not out yet.","Log the full assembled URL and open it in a browser to confirm the API truly returns zero rows; if the URL is malformed, check query params (order, limit, $where)."],"exampleFix":"# before\nobb.economy.cftc.cot(id='nonexistent-dataset').to_df()\n\n# after\nres = obb.economy.cftc.cot_search('crude oil')\nid_ = res.to_df()['id'][0]  # e.g. '100800' style series id\nobb.economy.cftc.cot(id=id_).to_df()","handlingStrategy":"fallback","validationCode":"known = obb.economy.cftc.cot_search('crude oil').to_df()\nassert not known.empty, 'no CFTC series matches the term'\nreport_id = known['id'].iloc[0]","typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\n\ntry:\n    data = obb.economy.cftc.cot(id=report_id).to_df()\nexcept EmptyDataError as e:\n    log.warning('CFTC empty for %s: %s', report_id, e)\n    data = obb.economy.cftc.cot(id=report_id, report_date=previous_friday()).to_df()","preventionTips":["Resolve dataset ids via cot_search at build time, never hand-type them.","For 'latest' reports, fall back to the prior publication date.","Cache the id lookup so invalid ids fail fast and once."],"tags":["cftc","cot","empty-data","dataset-id","openbb"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}