OpenBB-finance/OpenBB · warning · EmptyDataError

No results found for the provided query.

Error message

No results found for the provided query.

What it means

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.

Source

Thrown at openbb_platform/providers/fred/openbb_fred/models/search.py:291

            if query.tag_names and query.search_type != "series_id"
            else []
        )
        terms += tags

        if terms and query.search_type != "series_id":
            combined_mask = Series([True] * len(df))
            for term in terms:
                mask = df.apply(
                    lambda row, term=term: row.astype(str).str.contains(
                        term, case=False, regex=True, na=False
                    )
                ).any(axis=1)
                combined_mask &= mask

            matches = df[combined_mask]

            if matches.empty:
                raise EmptyDataError("No results found for the provided query.")

            df = matches

        df = df.replace({nan: None})

        if query.order_by in df.columns:
            df = df.sort_values(
                by=query.order_by, ascending=query.sort_order == "asc"
            ).reset_index(drop=True)

        if "series_group" in df.columns:
            df.series_group = df.series_group.astype(str)

        if "release_id" in df.columns:
            df.release_id = df.release_id.astype(str)

        if query.limit is not None and len(df) > query.limit:
            df = df.iloc[: query.limit]

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Split multi-term queries into separate calls and merge results locally (OR instead of AND).
  2. Escape or remove regex metacharacters (parens, brackets, asterisks) from terms.
  3. Reduce to a single term, then add terms back one at a time to find the excluding one.
  4. Drop tag_names to see whether the tag filter is what eliminates all rows.

Example fix

# before - terms are ANDed, may match nothing
res = obb.economy.fred.search(query='oil;production;monthly')

# after - OR semantics client-side
import pandas as pd
frames = [obb.economy.fred.search(query=t).to_df() for t in ['oil', 'production', 'monthly']]
res = pd.concat(frames).drop_duplicates(subset='series_id')
Defensive patterns

Strategy: try-catch

Validate before calling

# client-side: replicate the provider's AND filter to predict emptiness before calling
import re

def will_match(rows: list[dict], terms: list[str]) -> bool:
    for t in terms:
        pat = re.compile(re.escape(t), re.IGNORECASE)
        if not any(pat.search(str(v)) for row in rows for v in row.values()):
            return False
    return True

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError

try:
    res = obb.economy.fred.search(query=';'.join(terms))
except EmptyDataError:
    # provider ANDs terms; fall back to OR semantics locally
    res = merge_unique([obb.economy.fred.search(query=t) for t in terms])

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/535d8b214339cd2c. Report an issue: GitHub.