{"record":{"id":"378b7f7b82bbf47a","repo":"OpenBB-finance/OpenBB","slug":"no-data-remaining-after-applying-date-filters-try","errorCode":null,"errorMessage":"No data remaining after applying date filters. Try adjusting start_date and end_date parameters.","messagePattern":"No data remaining after applying date filters\\. Try adjusting start_date and end_date parameters\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/imf/openbb_imf/models/economic_indicators.py","lineNumber":1076,"sourceCode":"                    \"indicator_codes\",\n                    \"COUNTRY\",\n                    \"country_code\",\n                    \"SCALE\",\n                    \"UNIT\",\n                    \"unit_multiplier\",\n                }:\n                    continue\n                # Include dimension fields (UPPERCASE) and their _code variants\n                if key.isupper() or key.endswith(\"_code\"):\n                    # Convert to snake_case for the field name\n                    field_name = key.lower()\n                    new_row[field_name] = val\n\n            result.append(new_row)\n\n        # Check if all records were filtered out\n        if not result:\n            raise EmptyDataError(\n                \"No data remaining after applying date filters. \"\n                \"Try adjusting start_date and end_date parameters.\"\n            )\n\n        result.sort(\n            key=lambda x: (\n                x[\"order\"] if x.get(\"order\") is not None else 9999,\n                x[\"date\"] if x.get(\"date\") else \"\",\n                x[\"country\"] or \"\",\n            )\n        )\n        to_exclude = [\n            \"is_category_header\",\n            \"hierarchy_node_id\",\n            \"parent_id\",\n            \"indicator_code\",\n            \"parent_code\",\n            \"series_id\",","sourceCodeStart":1058,"sourceCodeEnd":1094,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/models/economic_indicators.py#L1058-L1094","documentation":"Raised after row-level filtering when every fetched observation was discarded by the start_date/end_date comparison, i.e. the IMF returned data but none of it falls inside the requested window. This catches the case where a `limit`-driven fetch (which pulls the most recent N periods regardless of dates) does not overlap the caller's date range.","triggerScenarios":"Setting start_date/end_date to a historical window while `limit` pulls only the most recent observations; or requesting a date range newer than the latest published observation, so post-fetch date filtering removes all rows.","commonSituations":"Combining `limit` with historical date filters; expecting current-year data for a series published with lag; timezone/annual-vs-quarterly date string mismatches causing strict comparisons to exclude everything.","solutions":["Drop `limit` when using historical start_date/end_date so the full series is fetched then filtered.","Shift start_date/end_date to overlap the series' published range (check the latest available period first with an unlimited call).","Loosen or remove the date filters entirely and slice locally after download."],"exampleFix":"# before\neconomic_indicators(indicator='NGDP_RPCH', limit=5, start_date='1990-01-01', end_date='1999-12-31')\n\n# after\neconomic_indicators(indicator='NGDP_RPCH', start_date='1990-01-01', end_date='1999-12-31')","handlingStrategy":"validation","validationCode":"# Do not combine limit with historical date windows\nif start_date and query_kwargs.get('limit') is not None:\n    if int(start_date[:4]) < CURRENT_YEAR - query_kwargs['limit']:\n        del query_kwargs['limit']  # full fetch, filter locally","typeGuard":null,"tryCatchPattern":"except EmptyDataError as e:\n    if 'date filters' in str(e):\n        res = await fetch(**{**kwargs, 'start_date': None, 'end_date': None})\n        res = [r for r in res if in_window(r.date)]  # filter locally","preventionTips":["Prefer fetching without limit and slicing locally","Check the series' latest available period before pinning end_date"],"tags":["imf","date-filter","empty-data","query-params"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}