{"record":{"id":"ada483379c1455ac","repo":"OpenBB-finance/OpenBB","slug":"no-data-found-for-the-given-query-try-adjusting-t","errorCode":null,"errorMessage":"No data found for the given query. Try adjusting the parameters.","messagePattern":"No data found for the given query\\. Try adjusting the parameters\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/fred/openbb_fred/models/bond_indices.py","lineNumber":573,"sourceCode":"        results[\"data\"] = result\n\n        return results\n\n    @staticmethod\n    def transform_data(\n        query: FredBondIndicesQueryParams,\n        data: dict,\n        **kwargs: Any,\n    ) -> AnnotatedResult[list[FredBondIndicesData]]:\n        \"\"\"Transform data.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from pandas import Categorical, DataFrame\n\n        if not data:\n            raise EmptyDataError(\"The request was returned empty.\")\n        df = DataFrame.from_records(data[\"data\"])\n        if df.empty:\n            raise EmptyDataError(\n                \"No data found for the given query. Try adjusting the parameters.\"\n            )\n        # Flatten the data as a pivot table.\n        df = (\n            df.melt(id_vars=\"date\", var_name=\"symbol\", value_name=\"value\")\n            .query(\"value.notnull()\")\n            .set_index([\"date\", \"symbol\"])\n            .sort_index()\n            .reset_index()\n        )\n        # Normalize the percent values.\n        if query.index_type != \"total_return\":\n            df[\"value\"] = df[\"value\"] / 100\n\n        titles_dict = {\n            symbol: data[\"metadata\"][symbol].get(\"title\")\n            for symbol in query._symbols.split(\",\")  # type: ignore  # pylint: disable=protected-access\n        }","sourceCodeStart":555,"sourceCodeEnd":591,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fred/openbb_fred/models/bond_indices.py#L555-L591","documentation":"Raised by FredBondIndicesFetch.transform_data when the payload exists but DataFrame.from_records(data['data']) yields an empty frame - the 'data' key held no observation records (or only header-ish entries). This catches the case where the FRED envelope is present yet contains zero rows after date filtering.","triggerScenarios":"FRED returns {'metadata': ..., 'data': {}} or {'data': []} for the requested BAML symbols - the series exist but have no observations in the requested window (e.g. dates before the index inception, or between publication dates).","commonSituations":"start_date earlier than the series' first observation with a narrow window that still misses all data; discontinued series; FRED publication lags for recent dates.","solutions":["Query without date filters to find the series' actual observation range, then re-query inside it","Check the series inception date on FRED's website for the mapped symbols","Move the window back one publication period (daily/monthly depending on the index)","Choose a longer-lived index within the same category"],"exampleFix":"# before\nres = await obb.economy.bond_indices(provider='fred', category='emerging_markets', index='high_yield', start_date='1990-01-01', end_date='1995-12-31').await_to_list()\n\n# after - use a window inside the series' coverage\nres = await obb.economy.bond_indices(provider='fred', category='emerging_markets', index='high_yield', start_date='2015-01-01', end_date='2024-12-31').await_to_list()","handlingStrategy":"validation","validationCode":"from pandas import DataFrame\npayload = await fetch_fred(symbols, start_date, end_date)\ndf = DataFrame.from_records(payload.get('data', []))\nassert not df.empty, 'no observations in window - check series inception dates'","typeGuard":"def has_records(payload: dict) -> bool:\n    return len(payload.get(\"data\", {})) > 0","tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\ntry:\n    rows = await obb.economy.bond_indices(provider='fred', start_date=s, end_date=e).await_to_list()\nexcept EmptyDataError as e:\n    if 'adjusting the parameters' in str(e):\n        rows = await obb.economy.bond_indices(provider='fred').await_to_list()  # full history","preventionTips":["Query full history once to learn each series' coverage, then constrain windows","Distinguish this message from the line-570 variant: it means the envelope had rows but none matched","Move windows back by one publication period when recent windows come back empty"],"tags":["fred","bond-indices","empty-data","date-range"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}