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 by the BLS search model when the pandas DataFrame built from BLS series metadata has zero rows matching every search term (case-insensitive substring/regex match across all columns). It means the BLS catalog contains no series matching the combined terms. This is an EmptyDataError - a normal 'no match' result for a search operation.

Source

Thrown at openbb_platform/providers/bls/openbb_bls/models/search.py:120

                if query.include_extras is True
                else df.filter(
                    items=["series_id", "series_title", "survey_name"], axis=1
                ).to_dict(orient="records")
            )
        else:
            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.")

            records = (
                matches.to_dict(orient="records")
                if query.include_extras is True
                else matches.filter(
                    items=["series_id", "series_title", "survey_name"], axis=1
                ).to_dict(orient="records")
            )

        return records

    @staticmethod
    def transform_data(
        query: BlsSearchQueryParams,
        data: list[dict],
        **kwargs: Any,
    ) -> AnnotatedResult[list[BlsSearchData]]:
        """Transform the data."""

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Use fewer or broader search terms - all terms must match the same row
  2. Check spelling and prefer canonical BLS survey names (e.g. 'CPI', 'JOLTS', 'unemployment')
  3. Escape regex special characters if a term contains them, since matching is regex=True
  4. Catch EmptyDataError and report 'no series found' to end users

Example fix

// before
obb.economy.survey(search='consumer price indeks 1982')  # EmptyDataError

// after
from openbb_core.provider.utils.errors import EmptyDataError
try:
    res = obb.economy.survey(search='consumer price index')
except EmptyDataError:
    res = []  # report no matching BLS series
Defensive patterns

Strategy: validation

Validate before calling

import re

def sanitize_search_terms(terms: list[str]) -> list[str]:
    # terms are regex-matched and AND-ed; escape metacharacters, keep terms few
    return [re.escape(t.strip()) for t in terms if t.strip()]

Try / catch

try:
    res = obb.economy.survey(search=query)
except EmptyDataError:
    res = []  # no matching BLS series

Prevention

When it happens

Trigger: Calling obb.economy.survey(search='nonexistent term'), using multiple terms where no single series contains all of them (terms are AND-ed via combined_mask), or regex-special characters in a term that match nothing.

Common situations: Typo'd search terms; overly narrow multi-term queries; searching for survey names that exist in FRED but not in BLS's local static catalog; regex metacharacters like '(' in terms.

Related errors


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