{"record":{"id":"535d8b214339cd2c","repo":"OpenBB-finance/OpenBB","slug":"no-results-found-for-the-provided-query-535d8b","errorCode":null,"errorMessage":"No results found for the provided query.","messagePattern":"No results found for the provided query\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/fred/openbb_fred/models/search.py","lineNumber":291,"sourceCode":"            if query.tag_names and query.search_type != \"series_id\"\n            else []\n        )\n        terms += tags\n\n        if terms and query.search_type != \"series_id\":\n            combined_mask = Series([True] * len(df))\n            for term in terms:\n                mask = df.apply(\n                    lambda row, term=term: row.astype(str).str.contains(\n                        term, case=False, regex=True, na=False\n                    )\n                ).any(axis=1)\n                combined_mask &= mask\n\n            matches = df[combined_mask]\n\n            if matches.empty:\n                raise EmptyDataError(\"No results found for the provided query.\")\n\n            df = matches\n\n        df = df.replace({nan: None})\n\n        if query.order_by in df.columns:\n            df = df.sort_values(\n                by=query.order_by, ascending=query.sort_order == \"asc\"\n            ).reset_index(drop=True)\n\n        if \"series_group\" in df.columns:\n            df.series_group = df.series_group.astype(str)\n\n        if \"release_id\" in df.columns:\n            df.release_id = df.release_id.astype(str)\n\n        if query.limit is not None and len(df) > query.limit:\n            df = df.iloc[: query.limit]","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fred/openbb_fred/models/search.py#L273-L309","documentation":"Raised in FredSearchFetcher.transform_data (openbb_fred/models/search.py:291) after the provider applied its own client-side filtering: the FRED response had rows, but none of them match the semicolon-separated query terms (case-insensitive regex 'contains' across all columns, ANDed) or the tag filter built in transform_data. It is an EmptyDataError signaling that FRED's server-side ranking returned rows that the local re-filter rejected.","triggerScenarios":"Multi-term queries like 'oil;production' where each term must appear somewhere in a row; regex special characters in query terms (e.g. 'CPI(USA)') failing literal matching; terms matching FRED's search index but not the returned columns.","commonSituations":"Reproducing FRED website searches that use OR semantics while this filter ANDs terms; unescaped regex metacharacters in user-supplied terms; appending tag filters on top of text filters.","solutions":["Split multi-term queries into separate calls and merge results locally (OR instead of AND).","Escape or remove regex metacharacters (parens, brackets, asterisks) from terms.","Reduce to a single term, then add terms back one at a time to find the excluding one.","Drop tag_names to see whether the tag filter is what eliminates all rows."],"exampleFix":"# before - terms are ANDed, may match nothing\nres = obb.economy.fred.search(query='oil;production;monthly')\n\n# after - OR semantics client-side\nimport pandas as pd\nframes = [obb.economy.fred.search(query=t).to_df() for t in ['oil', 'production', 'monthly']]\nres = pd.concat(frames).drop_duplicates(subset='series_id')","handlingStrategy":"try-catch","validationCode":"# client-side: replicate the provider's AND filter to predict emptiness before calling\nimport re\n\ndef will_match(rows: list[dict], terms: list[str]) -> bool:\n    for t in terms:\n        pat = re.compile(re.escape(t), re.IGNORECASE)\n        if not any(pat.search(str(v)) for row in rows for v in row.values()):\n            return False\n    return True","typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\n\ntry:\n    res = obb.economy.fred.search(query=';'.join(terms))\nexcept EmptyDataError:\n    # provider ANDs terms; fall back to OR semantics locally\n    res = merge_unique([obb.economy.fred.search(query=t) for t in terms])","preventionTips":["Semicolon-separated query terms are ANDed - prefer single-term calls for OR semantics.","re.escape user input used as query terms to avoid accidental regex behavior."],"tags":["fred","search","filter","empty-data","regex"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}