{"record":{"id":"9b54c1f577784807","repo":"OpenBB-finance/OpenBB","slug":"there-was-an-error-with-the-request-and-it-was-ret-9b54c1","errorCode":null,"errorMessage":"There was an error with the request and it was returned empty.","messagePattern":"There was an error with the request and it was returned empty\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/fred/openbb_fred/models/senior_loan_officer_survey.py","lineNumber":129,"sourceCode":"        return {\n            \"metadata\": response.metadata,\n            \"data\": [d.model_dump() for d in response.result],\n        }\n\n    @staticmethod\n    def transform_data(\n        query: FredSeniorLoanOfficerSurveyQueryParams,\n        data: dict,\n        **kwargs: Any,\n    ) -> AnnotatedResult[list[FredSeniorLoanOfficerSurveyData]]:\n        \"\"\"Transform data.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from pandas import DataFrame\n\n        metadata = data.get(\"metadata\", {})\n        df = DataFrame(data.get(\"data\", [])).dropna()\n        if df.empty:\n            raise EmptyDataError(\n                \"There was an error with the request and it was returned empty.\"\n            )\n        # Flatten data\n        df = df.melt(id_vars=\"date\", var_name=\"symbol\", value_name=\"value\").query(\n            \"value.notnull()\"\n        )\n        df[\"title\"] = df.symbol.apply(lambda x: metadata[x].get(\"title\", \"\"))\n        df[\"value\"] = df[\"value\"].astype(float) / 100\n        df = df.fillna(\"N/A\").replace(\"N/A\", None)\n        records = df.sort_values(by=\"date\").to_dict(orient=\"records\")\n\n        return AnnotatedResult(\n            result=[FredSeniorLoanOfficerSurveyData.model_validate(d) for d in records],\n            metadata=metadata,\n        )\n","sourceCodeStart":111,"sourceCodeEnd":145,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fred/openbb_fred/models/senior_loan_officer_survey.py#L111-L145","documentation":"Raised in FredSeniorLoanOfficerSurveyFetcher.transform_data (openbb_fred/models/senior_loan_officer_survey.py:129) when the wrapped FredSeriesFetcher result contains no data rows (or all rows are NaN and dropped). The survey data arrives as a wide date-by-series DataFrame; if the upstream series request came back without observations (rate limiting, invalid IDs, out-of-range dates) the DataFrame is empty and this EmptyDataError fires.","triggerScenarios":"Calling economy/fred senior-loan-officer-survey while the FRED key is rate limited; a date range outside the survey's quarterly publication window; FRED temporarily missing the survey series.","commonSituations":"Backtesting jobs that call many FRED endpoints in a loop and trip the 50-req/min cap mid-batch; requesting future quarters.","solutions":["Retry after 60 seconds to rule out rate limiting.","Clear or widen start_date/end_date to include published quarters.","Confirm the underlying series (e.g. DRTSCILM) still resolves via fred_series."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\nimport time\n\ntry:\n    res = obb.economy.fred.senior_loan_officer_survey(start_date=s, end_date=e)\nexcept EmptyDataError:\n    time.sleep(60)  # likely rate limited\n    res = obb.economy.fred.senior_loan_officer_survey()  # retry unfiltered","preventionTips":["Space out multi-endpoint FRED jobs or cache survey output (quarterly data changes slowly).","Align date ranges with the quarterly publication calendar."],"tags":["fred","survey","empty-data","rate-limit"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}