OpenBB-finance/OpenBB · error · OpenBBError

A query is required for search_type 'full_text' or 'series_i

Error message

A query is required for search_type 'full_text' or 'series_id'.

What it means

Raised in FredSearchFetcher.transform_query (openbb_fred/models/search.py:168) when search_type is 'full_text' or 'series_id' (or is unset) but no 'query' and no 'series_id' was supplied. The fetcher needs a text query to hit /fred/series/search, so it refuses to build an underspecified request rather than send one FRED would reject. This is a client-side parameter validation error, thrown before any network call.

Source

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

        if (
            transformed_params.get("release_id")
            and not transformed_params.get("search_type")
        ) or (
            not transformed_params.get("query")
            and not transformed_params.get("release_id")
            and not transformed_params.get("series_id")
        ):
            transformed_params["search_type"] = "release"
        elif (
            not transformed_params.get("query")
            and (
                transformed_params.get("search_type") in ["full_text", "series_id"]
                or not transformed_params.get("search_type")
            )
            and not transformed_params.get("series_id")
        ):
            raise OpenBBError(
                "A query is required for search_type 'full_text' or 'series_id'."
            )

        if transformed_params.get("exclude_tag_names") and not transformed_params.get(
            "tag_names"
        ):
            raise OpenBBError(
                "Field 'exclude_tag_names' requires 'tag_names' to be set."
            )

        return FredSearchQueryParams.model_validate(transformed_params)

    @staticmethod
    async def aextract_data(
        query: FredSearchQueryParams,
        credentials: dict[str, str] | None,
        **kwargs: Any,
    ) -> list[dict]:

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Pass a non-empty 'query' when search_type is 'full_text' or 'series_id'.
  2. Or pass 'series_id' (comma-separated IDs) to look up specific series.
  3. Or set search_type explicitly to 'release' if you wanted the release listing.
  4. If query comes from user input, default it or branch before calling fred_search.

Example fix

# before
obb.economy.fred.search(search_type='full_text')

# after
obb.economy.fred.search(query='inflation', search_type='full_text')
Defensive patterns

Strategy: validation

Validate before calling

def validate_search_params(params: dict) -> dict:
    st = params.get('search_type')
    if st in (None, 'full_text', 'series_id'):
        if not params.get('query') and not params.get('series_id'):
            raise ValueError("fred_search requires 'query' (or 'series_id') for this search_type")
    return params

Type guard

def is_searchable_params(p: dict) -> bool:
    """True when the params satisfy fred_search's transform_query contract."""
    if p.get('search_type') in ('full_text', 'series_id') or not p.get('search_type'):
        return bool(p.get('query')) or bool(p.get('series_id'))
    return True

Try / catch

from openbb_core.provider.abstract.data import OpenBBError  # or openbb_core.app.model.abstract.error

try:
    obb.economy.fred.search(search_type='full_text', query=q)
except OpenBBError as e:
    if 'query is required' in str(e):
        q = q or DEFAULT_QUERY
        obb.economy.fred.search(search_type='full_text', query=q)
    else:
        raise

Prevention

When it happens

Trigger: fred_search(search_type='full_text') with no query; fred_search(search_type='series_id') with neither query nor series_id; calling with only is_filter_transaction etc. but no query text.

Common situations: Building search calls dynamically and passing an empty string query; upgrading from an older version where search_type='series_id' without query silently fell back to a release listing.

Related errors


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