{"record":{"id":"96ef3eae3b16beff","repo":"OpenBB-finance/OpenBB","slug":"no-results-found-for-search-term","errorCode":null,"errorMessage":"No results found for '{search_term}'.","messagePattern":"No results found for '(.+?)'\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/cftc/openbb_cftc/models/cot_search.py","lineNumber":204,"sourceCode":"            }\n            sub = subcategory_map.get(\n                query.subcategory,\n                query.subcategory.replace(\"_\", \" \").upper(),\n            )\n            where_parts.append(f\"UPPER(commodity_subgroup_name) = '{sub}'\")\n\n        if where_parts:\n            base_url += \"&$where=\" + quote(\" AND \".join(where_parts))\n\n        url = f\"{base_url}&$$app_token={app_token}\" if app_token else base_url\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(\n                f\"No results found for '{search_term}'.\"\n                if search_term\n                else \"No results returned from the CFTC API.\"\n            )\n\n        return response  # type: ignore\n\n    @staticmethod\n    def transform_data(\n        query: CftcCotSearchQueryParams,\n        data: list[dict],\n        **kwargs: Any,\n    ) -> list[CftcCotSearchData]:\n        \"\"\"Transform the data.\"\"\"\n        results: list[CftcCotSearchData] = []\n        seen: set[str] = set()\n        for d in data:\n            code = d.get(\"cftc_contract_market_code\", \"\")","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/cftc/openbb_cftc/models/cot_search.py#L186-L222","documentation":"EmptyDataError from the CFTC search endpoint (cot_search.py:204) when the Socrata $query built from your search term (and optional filters) returns no matching dataset records. There are two messages: one embedding your search term when you supplied one, and a generic 'No results returned from the CFTC API.' when the term was empty — distinguishing a bad search from an API-wide empty answer.","triggerScenarios":"Searching with a term CFTC dataset titles do not contain (e.g. 'wti crude' vs their official naming); combining search_term with restrictive where-clauses (report_type, data_format) that exclude all matches; searching exotic instruments the CFTC does not track.","commonSituations":"Using colloquial commodity names instead of CFTC's official report titles; auto-complete flows firing one-character queries; filtering by the wrong granularity ('detail' vs 'disagg') so every row is excluded.","solutions":["Broaden or correct the term: use official CFTC naming, e.g. 'Crude Oil' or 'WTI' rather than slang.","Drop optional filters (report_type/data_format) to see any match first, then narrow down.","If every term fails, test the raw CFTC Socrata endpoint in a browser to rule out an API outage or schema change."],"exampleFix":"# before\nobb.economy.cftc.cot_search(search_term='petrol')\n\n# after\nobb.economy.cftc.cot_search(search_term='crude oil')","handlingStrategy":"fallback","validationCode":"term = 'crude oil'  # use official CFTC report naming\nres = obb.economy.cftc.cot_search(search_term=term)\nrows = res.results if hasattr(res, 'results') else res","typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\n\nterms = ['crude oil', 'petroleum', 'energy']\nfor t in terms:\n    try:\n        df = obb.economy.cftc.cot_search(search_term=t).to_df()\n        if not df.empty:\n            break\n    except EmptyDataError:\n        continue","preventionTips":["Try several synonyms of the commodity name before giving up.","Loosen optional filters first when diagnosing zero-result searches.","Keep a curated map of commodity -> official CFTC title."],"tags":["cftc","search","empty-data","naming","openbb"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}