{"record":{"id":"ba298f30dbbdc3cb","repo":"OpenBB-finance/OpenBB","slug":"no-results-found-try-adjusting-the-query-paramete-ba298f","errorCode":null,"errorMessage":"No results found. Try adjusting the query parameters.","messagePattern":"No results found\\. Try adjusting the query parameters\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/federal_reserve/openbb_federal_reserve/utils/ny_fed_api.py","lineNumber":481,"sourceCode":"                \"soma_holdings\"\n            ][\"agency_debts\"]\n            response = await fetch_data(url)\n            return [response.get(\"soma\", {})]\n        url = _get_endpoints(date=as_of)[\"soma_holdings\"][\"get_as_of\"]\n        if holding_type is not None:\n            if holding_type not in AGENCY_HOLDING_TYPES:\n                raise OpenBBError(\n                    \"Invalid choice. Choose from: ['all', 'agency debts', 'mbs', 'cmbs']\"\n                )\n            url = _get_endpoints(\n                agency_holding_type=AGENCY_HOLDING_TYPES[holding_type], date=as_of\n            )[\"soma_holdings\"][\"get_holding_type\"]\n        if cusip is not None:\n            url = _get_endpoints(cusips=cusip)[\"soma_holdings\"][\"get_cusip\"]\n        response = await fetch_data(url)\n        holdings = response.get(\"soma\", {}).get(\"holdings\", [])\n        if not holdings:\n            raise EmptyDataError()\n\n        return holdings\n\n    async def get_treasury_holdings(  # pylint: disable=R0917\n        self,\n        as_of: str | None = None,\n        cusip: str | None = None,\n        holding_type: str | None = None,\n        wam: bool | None = False,\n        monthly: bool | None = False,\n    ) -> list[dict]:\n        \"\"\"Get the latest Treasury holdings, or as of a single date.\n\n        Parameters\n        ----------\n        as_of: Optional[str]\n            The as-of date to get data for. Defaults to the latest.\n        cusip: Optional[str]","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/federal_reserve/openbb_federal_reserve/utils/ny_fed_api.py#L463-L499","documentation":"EmptyDataError (default message 'No results found. Try adjusting the query parameters.') raised at the end of get_agency_holdings when the NY Fed response contains an empty soma.holdings array. The request succeeded and validation passed, but nothing matched the as_of/cusip/holding_type combination.","triggerScenarios":"Passing an as_of date that is not a valid SOMA operations date (e.g. a weekend or holiday); a CUSIP not present in the agency portfolio; holding_type + date combos with no rows; or upstream empty responses.","commonSituations":"Using calendar dates instead of SOMA business dates (obtainable via get_as_of_dates); typo'd CUSIPs; querying before the dataset's start date.","solutions":["Fetch valid dates with await SomaHoldings().get_as_of_dates() and pass one explicitly.","Double-check the CUSIP against the Fed's published holdings; drop cusip to see if any rows return for that date.","Handle EmptyDataError as a no-match result in the caller."],"exampleFix":"// before\nh = await SomaHoldings().get_agency_holdings(as_of='2024-06-01')  # a Saturday\n// after\ndates = await SomaHoldings().get_as_of_dates()\nh = await SomaHoldings().get_agency_holdings(as_of=dates[0])","handlingStrategy":"validation","validationCode":"dates = await SomaHoldings().get_as_of_dates()\nif as_of and as_of not in dates:\n    as_of = dates[0]  # snap to nearest valid SOMA operations date","typeGuard":null,"tryCatchPattern":"from openbb_core.provider.standard_errors import EmptyDataError\ntry:\n    holdings = await SomaHoldings().get_agency_holdings(as_of=as_of, cusip=cusip)\nexcept EmptyDataError:\n    holdings = await SomaHoldings().get_agency_holdings(as_of=as_of)  # retry without cusip filter","preventionTips":["Always source as_of from get_as_of_dates, never calendar guesses","Verify CUSIPs exist in the portfolio before filtering on them"],"tags":["openbb","ny-fed","soma","empty-data","dates"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}