{"record":{"id":"1a08abbdbdb558c0","repo":"OpenBB-finance/OpenBB","slug":"the-request-was-returned-empty-1a08ab","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/federal_reserve/openbb_federal_reserve/models/primary_dealer_positioning.py","lineNumber":125,"sourceCode":"\n        symbols = POSITION_GROUPS_TO_SERIES.get(query.category, [])\n        results: list[dict] = []\n\n        base_url = \"https://markets.newyorkfed.org/api/pd/get/\"\n        urls = [base_url + symbol + \".json\" for symbol in symbols]\n\n        async def get_one(url):\n            \"\"\"Get data for a single URL.\"\"\"\n            result = await amake_request(url)\n            if isinstance(result, dict):\n                data = result.get(\"pd\", {}).get(\"timeseries\")\n                if data:\n                    results.extend(data)\n\n        await asyncio.gather(*[get_one(url) for url in urls])\n\n        if not results:\n            raise EmptyDataError(\"The request was returned empty.\")\n\n        return results\n\n    @staticmethod\n    def transform_data(\n        query: FederalReservePrimaryDealerPositioningQueryParams,\n        data: list[dict],\n        **kwargs: Any,\n    ) -> list[FederalReservePrimaryDealerPositioningData]:\n        \"\"\"Transform the data.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from openbb_federal_reserve.utils.primary_dealer_statistics import (\n            POSITION_SERIES_TO_FIELD,\n            POSITION_SERIES_TO_TITLE,\n        )\n        from pandas import DataFrame\n\n        df = DataFrame(data)","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/federal_reserve/openbb_federal_reserve/models/primary_dealer_positioning.py#L107-L143","documentation":"Raised by FederalReservePrimaryDealerPositioningFetch after asyncio.gather over all week URLs when none of the responses contained a 'pd'.'timeseries' payload. The fetcher collects timeseries from each URL and only errors when the aggregated list is empty, so partial outages still return data. It is an EmptyDataError, rendered by OpenBB as a no-results condition.","triggerScenarios":"Calling the primary dealer positioning endpoint where every weekly URL response lacks result['pd']['timeseries'] — e.g. the API changed its JSON shape, all requested weeks are outside the published window, or the service is down and amake_request returns non-dict results that are silently skipped.","commonSituations":"NY Fed API schema change (key renamed from 'pd'); requesting weeks before data publication started; network egress blocked so every get_one returns nothing without raising.","solutions":["Inspect one of the generated URLs manually and check the response still contains the 'pd' -> 'timeseries' keys; if renamed, update the parser.","Verify the requested week dates fall within the dataset's published range.","Catch EmptyDataError upstream and degrade to an empty DataFrame or cached data."],"exampleFix":"try:\n    res = await obb.fixedincome.corporate.primary_dealer_positioning(provider='federal_reserve')\nexcept EmptyDataError:\n    res = None\n# optionally: verify shape first\n# import httpx; r = await httpx.AsyncClient().get(url); assert 'pd' in r.json()","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    res = await obb.fixedincome.corporate.primary_dealer_positioning(provider='federal_reserve')\nexcept EmptyDataError:\n    res = None","preventionTips":["Smoke-test one weekly URL's JSON shape ('pd' -> 'timeseries') after provider upgrades","Cache last good response for dashboard resilience"],"tags":["openbb","ny-fed","primary-dealer","empty-data"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}