{"record":{"id":"9ee03924e584b90d","repo":"OpenBB-finance/OpenBB","slug":"the-request-was-returned-empty-9ee039","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/fred/openbb_fred/models/yield_curve.py","lineNumber":76,"sourceCode":"    def transform_query(params: dict[str, Any]) -> FREDYieldCurveQueryParams:\n        \"\"\"Transform query.\"\"\"\n        return FREDYieldCurveQueryParams(**params)\n\n    @staticmethod\n    async def aextract_data(\n        query: FREDYieldCurveQueryParams,\n        credentials: dict[str, str] | None,\n        **kwargs: Any\n    ) -> list[dict]:\n        \"\"\"Extract data.\"\"\"\n        api_key = credentials.get(\"fred_api_key\") if credentials else \"\"\n        series_ids = \",\".join(list(YIELD_CURVES[query.yield_curve_type]))\n        fetcher = FredSeriesFetcher()\n        data = await fetcher.fetch_data(\n            {\"symbol\": series_ids}, {\"fred_api_key\": api_key}  # type: ignore\n        )\n        if not data:\n            raise EmptyDataError(\"The request was returned empty.\")\n        results = [d.model_dump() for d in data.result]  # type: ignore\n\n        return results\n\n    @staticmethod\n    def transform_data(\n        query: FREDYieldCurveQueryParams, data: list[dict], **kwargs: Any\n    ) -> list[FREDYieldCurveData]:\n        \"\"\"Transform data.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from pandas import Categorical, DataFrame, DatetimeIndex\n\n        df = DataFrame(data).set_index(\"date\").sort_index()\n        df.index = df.index.astype(str)\n        dates = query.date.split(\",\") if query.date else [df.index.max()]  # type: ignore\n        df.index = DatetimeIndex(df.index)\n        dates_list = DatetimeIndex(dates)\n        maturity_dict = YIELD_CURVES[query.yield_curve_type]","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fred/openbb_fred/models/yield_curve.py#L58-L94","documentation":"Raised in FREDYieldCurveFetcher.extract_data (openbb_fred/models/yield_curve.py:76) when the delegated FredSeriesFetcher result is falsy for the requested yield_curve_type ('monthly' or 'daily' fixed Treasury CMT series sets). The code then immediately calls data.result, so this guard mainly protects against a None/empty fetcher response. In practice the more common failure is an empty .result list, which passes this check and surfaces as empty output rather than this error.","triggerScenarios":"economy/fred yield-curve while rate limited such that the internal fetcher returns nothing; a malformed credentials dict leaving api_key empty; unexpected fetcher API changes returning a falsy result object.","commonSituations":"High-frequency jobs hitting FRED's 50-req/min cap; missing fred_api_key causing the inner series fetch to fail into an empty result.","solutions":["Confirm a valid fred_api_key is configured.","Retry after a minute to rule out rate limiting.","If the call 'succeeds' but returns no rows, fetch the CMT series directly (e.g. DGS10) via fred_series to confirm availability."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\n\ntry:\n    curve = obb.economy.fred.yield_curve(yield_curve_type=t)\nexcept EmptyDataError:\n    curve = None  # degrade gracefully, e.g. serve last cached curve\n    curve = load_cached_curve(t)","preventionTips":["The endpoint fetches ~a dozen series per call - account for that in rate-limit budgets.","Cache the daily curve; it changes once per business day."],"tags":["fred","yield-curve","treasury","empty-data"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}