{"record":{"id":"365d9456b06a9d06","repo":"OpenBB-finance/OpenBB","slug":"the-request-was-returned-empty-365d94","errorCode":null,"errorMessage":"The request was returned empty.","messagePattern":"The request was returned empty\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/ecb/openbb_ecb/models/yield_curve.py","lineNumber":135,"sourceCode":"        tasks = [get_one(maturity, query.use_cache) for maturity in MATURITIES]\n\n        await asyncio.gather(*tasks)\n\n        return results\n\n    @staticmethod\n    def transform_data(\n        query: ECBYieldCurveQueryParams,\n        data: list[dict],\n        **kwargs: Any,\n    ) -> list[ECBYieldCurveData]:\n        \"\"\"Transform data.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from openbb_ecb.utils.yield_curve_series import MATURITIES  # noqa\n        from pandas import Categorical, DataFrame, DatetimeIndex  # noqa\n\n        if not data:\n            raise EmptyDataError(\"The request was returned empty.\")\n        dates = (\n            str(query.date).split(\",\")\n            if query.date\n            else [datetime.now().strftime(\"%Y-%m-%d\")]\n        )\n        dates_list = DatetimeIndex(dates)\n\n        # Find the nearest date to the requested one.\n        df = DataFrame(data).set_index(\"date\").query(\"`rate`.notnull()\")\n        df.index = DatetimeIndex(df.index)\n        df_unique_dates = df[\n            ~df.index.duplicated(keep=\"first\")\n        ].sort_index()  # DataFrame with unique dates\n        nearest_dates = [df_unique_dates.index.asof(date) for date in dates_list]\n        # Filter for only the nearest dates\n        df = df[df.index.isin(nearest_dates)]\n\n        # Flatten the DataFrame","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/ecb/openbb_ecb/models/yield_curve.py#L117-L153","documentation":"EmptyDataError raised in ECBYieldCurveFetcher.transform_data when the data list handed from extract_data is empty — i.e. extraction technically produced nothing (or every observation failed validation upstream). Distinct from error 284, which fires per-maturity during extraction; this is the transform-stage backstop.","triggerScenarios":"The extract stage returned an empty list without raising (e.g. all responses were non-list empty dicts), or downstream code filtered out every row before transform. Also reached when the requested date has no curve published (weekends/holidays are filtered by nearest-date matching).","commonSituations":"Requesting a specific query.date that falls on a weekend or ECB holiday; ECB publishing delay on the current business day; partial outages where responses are non-empty falsy shapes.","solutions":["Query the most recent business day explicitly instead of relying on today's date.","Retry later the same day — the ECB curve is published mid-day CET.","Verify the raw API per maturity (data.ecb.europa.eu/data-detail-api) to confirm data exists for that date.","Treat EmptyDataError as 'no result' rather than a crash and fall back to the prior business day."],"exampleFix":"# before\ncurve = obb.fixedincome.government_yield_curve(provider=\"ecb\", date=\"2025-01-05\")  # Sunday\n\n# after\nfrom pandas.tseries.offsets import BDay\nlast_bday = (pd.Timestamp.today() - BDay(1)).strftime(\"%Y-%m-%d\")\ncurve = obb.fixedincome.government_yield_curve(provider=\"ecb\", date=last_bday)","handlingStrategy":"validation","validationCode":"import pandas as pd\nfrom pandas.tseries.offsets import BDay\n\ndef valid_curve_date(d: str) -> str:\n    ts = pd.Timestamp(d) if d else (pd.Timestamp.today() - BDay(1))\n    if ts.weekday() >= 5:\n        ts = ts - BDay(1)  # roll off weekend\n    return ts.strftime(\"%Y-%m-%d\")","typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\ntry:\n    curve = obb.fixedincome.government_yield_curve(provider=\"ecb\", date=d)\nexcept EmptyDataError:\n    curve = obb.fixedincome.government_yield_curve(provider=\"ecb\", date=prev_business_day(d))","preventionTips":["Request the latest completed business day, not today.","Remember the ECB curve publishes mid-day CET; schedule jobs after ~16:00 CET.","Treat EmptyDataError as a signal to roll the date back one business day."],"tags":["ecb","yield-curve","empty-data","holiday","publishing-schedule"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}