{"record":{"id":"4cb3631d2c3597c2","repo":"OpenBB-finance/OpenBB","slug":"a-query-is-required-for-search-type-full-text-or","errorCode":null,"errorMessage":"A query is required for search_type 'full_text' or 'series_id'.","messagePattern":"A query is required for search_type 'full_text' or 'series_id'\\.","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/fred/openbb_fred/models/search.py","lineNumber":168,"sourceCode":"\n        if (\n            transformed_params.get(\"release_id\")\n            and not transformed_params.get(\"search_type\")\n        ) or (\n            not transformed_params.get(\"query\")\n            and not transformed_params.get(\"release_id\")\n            and not transformed_params.get(\"series_id\")\n        ):\n            transformed_params[\"search_type\"] = \"release\"\n        elif (\n            not transformed_params.get(\"query\")\n            and (\n                transformed_params.get(\"search_type\") in [\"full_text\", \"series_id\"]\n                or not transformed_params.get(\"search_type\")\n            )\n            and not transformed_params.get(\"series_id\")\n        ):\n            raise OpenBBError(\n                \"A query is required for search_type 'full_text' or 'series_id'.\"\n            )\n\n        if transformed_params.get(\"exclude_tag_names\") and not transformed_params.get(\n            \"tag_names\"\n        ):\n            raise OpenBBError(\n                \"Field 'exclude_tag_names' requires 'tag_names' to be set.\"\n            )\n\n        return FredSearchQueryParams.model_validate(transformed_params)\n\n    @staticmethod\n    async def aextract_data(\n        query: FredSearchQueryParams,\n        credentials: dict[str, str] | None,\n        **kwargs: Any,\n    ) -> list[dict]:","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fred/openbb_fred/models/search.py#L150-L186","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a non-empty 'query' when search_type is 'full_text' or 'series_id'.","Or pass 'series_id' (comma-separated IDs) to look up specific series.","Or set search_type explicitly to 'release' if you wanted the release listing.","If query comes from user input, default it or branch before calling fred_search."],"exampleFix":"# before\nobb.economy.fred.search(search_type='full_text')\n\n# after\nobb.economy.fred.search(query='inflation', search_type='full_text')","handlingStrategy":"validation","validationCode":"def validate_search_params(params: dict) -> dict:\n    st = params.get('search_type')\n    if st in (None, 'full_text', 'series_id'):\n        if not params.get('query') and not params.get('series_id'):\n            raise ValueError(\"fred_search requires 'query' (or 'series_id') for this search_type\")\n    return params","typeGuard":"def is_searchable_params(p: dict) -> bool:\n    \"\"\"True when the params satisfy fred_search's transform_query contract.\"\"\"\n    if p.get('search_type') in ('full_text', 'series_id') or not p.get('search_type'):\n        return bool(p.get('query')) or bool(p.get('series_id'))\n    return True","tryCatchPattern":"from openbb_core.provider.abstract.data import OpenBBError  # or openbb_core.app.model.abstract.error\n\ntry:\n    obb.economy.fred.search(search_type='full_text', query=q)\nexcept OpenBBError as e:\n    if 'query is required' in str(e):\n        q = q or DEFAULT_QUERY\n        obb.economy.fred.search(search_type='full_text', query=q)\n    else:\n        raise","preventionTips":["Never build fred_search calls where query can be an empty string; default it.","If query is user-supplied, branch to search_type='release' when it is blank."],"tags":["fred","search","validation","parameters"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}