OpenBB-finance/OpenBB · error · OpenBBError
Field 'exclude_tag_names' requires 'tag_names' to be set.
Error message
Field 'exclude_tag_names' requires 'tag_names' to be set.
What it means
Raised in FredSearchFetcher.transform_query (openbb_fred/models/search.py:175) when 'exclude_tag_names' is set but 'tag_names' is empty. FRED's search API only accepts exclusion tags as a modifier of an inclusive tag filter, so the provider rejects the combination up front. Pure client-side validation; nothing is sent to FRED.
Source
Thrown at openbb_platform/providers/fred/openbb_fred/models/search.py:175
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]:
"""Extract the raw data."""
# pylint: disable=import-outside-toplevel
import asyncio # noqa
from openbb_core.provider.utils.helpers import get_querystring
from openbb_fred.utils.rate_limiter import fred_get
api_key = credentials.get("fred_api_key") if credentials else ""View on GitHub (pinned to 3e071fcc2c)
Solutions
- Add the corresponding 'tag_names' value, e.g. tag_names='cpi', exclude_tag_names='discontinued'.
- Or remove 'exclude_tag_names' from the request entirely.
- Guard at the call site: only set exclude_tag_names when tag_names is truthy.
Example fix
# before obb.economy.fred.search(query='prices', exclude_tag_names='discontinued') # after obb.economy.fred.search(query='prices', tag_names='cpi', exclude_tag_names='discontinued')
Defensive patterns
Strategy: validation
Validate before calling
if params.get('exclude_tag_names') and not params.get('tag_names'):
params.pop('exclude_tag_names') # or raise your own validation error Type guard
def tags_are_consistent(p: dict) -> bool:
"""exclude_tag_names is only legal together with tag_names."""
return not (bool(p.get('exclude_tag_names')) and not p.get('tag_names')) Prevention
- Model tag_names/exclude_tag_names as one optional pair in your config, never independent fields.
- Strip exclude_tag_names automatically when the user provides no inclusive tags.
When it happens
Trigger: fred_search(query='cpi', exclude_tag_names='discontinued') without tag_names; programmatically copying an exclude list into params while the include list is conditionally empty.
Common situations: UIs that let users type 'tags to exclude' independently of 'tags to include'; refactors that renamed the inclusive field but left the exclusive one populated.
Related errors
- A query is required for search_type 'full_text' or 'series_i
- No results found for the provided query.
- No tables were found for the release, {query.release_id}. Us
- The request was returned empty.
- No results found for the provided query.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/09d51c3254181f39.
Report an issue: GitHub.