{"record":{"id":"9dc5fdb05a5163a7","repo":"OpenBB-finance/OpenBB","slug":"a-query-must-be-provided-when-no-dataflows-and-key","errorCode":null,"errorMessage":"A query must be provided when no dataflows and keywords are specified.","messagePattern":"A query must be provided when no dataflows and keywords are specified\\.","errorType":"validation","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/imf/openbb_imf/utils/metadata.py","lineNumber":214,"sourceCode":"            dataflows will be searched, which can be slow.\n        keywords : list[str] | None, optional\n            List of keywords to filter results. Each keyword is a single word that must\n            appear in the indicator's label or description. Keywords prefixed with \"not \"\n            will exclude indicators containing that word (e.g., \"not USD\" excludes indicators\n            with \"USD\" in them).\n        Returns\n        -------\n        list[dict]\n            A list of matching indicators with table/hierarchy information included.\n        \"\"\"\n        target_dataflow_ids: list = []\n        if dataflows:\n            target_dataflow_ids = (\n                [dataflows] if isinstance(dataflows, str) else dataflows\n            )\n        else:\n            if not query and not keywords:\n                raise OpenBBError(\n                    \"A query must be provided when no dataflows and keywords are specified.\"\n                )\n            target_dataflow_ids = list(self.dataflows.keys())\n\n        if not target_dataflow_ids:\n            raise OpenBBError(\n                \"No valid dataflows found to search indicators in.\"\n                \"This might be due to incorrect dataflow IDs.\"\n            )\n\n        # Build a map of indicators to their tables for enrichment\n        indicator_to_tables: dict[str, list[dict]] = {}\n        # Also build searchable text for each indicator from their tables\n        indicator_table_text: dict[str, str] = {}\n\n        for df_id in set(target_dataflow_ids):\n            try:\n                hierarchies = self.get_dataflow_hierarchies(df_id)","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/utils/metadata.py#L196-L232","documentation":"Raised by search_indicators when the dataflows argument is empty AND both query and keywords are also empty. Searching indicators across every dataflow is expensive, so the API refuses to scan all dataflows with no filter — you must narrow either by target dataflow(s) or by a query/keyword. This is a guard against accidental full-catalog scans, not a data problem.","triggerScenarios":"search_indicators() with no arguments; all three filter variables left as None/'' by wrapper code that conditionally sets them.","commonSituations":"Optional search boxes in UIs where the user hits submit without typing anything; exploratory scripts calling the endpoint 'just to see what's there'.","solutions":["Pass at least one of: dataflows='IMTS', a query string, or keywords.","If you truly want to browse, first list dataflows (search_dataflows or the dataflows dict) and then search indicators per dataflow.","Default empty form submissions to a helpful message instead of calling the API."],"exampleFix":"# before\nres = meta.search_indicators()  # nothing supplied\n\n# after\nres = meta.search_indicators(dataflows='IMTS')\n# or\nres = meta.search_indicators(query='exports')","handlingStrategy":"validation","validationCode":"if not (dataflows or query or keywords):\n    dataflows = 'IMTS'  # or raise: 'narrow your search'\nresults = meta.search_indicators(dataflows=dataflows, query=query, keywords=keywords)","typeGuard":"def has_search_filter(dataflows, query, keywords) -> bool:\n    def truthy(v):\n        return bool(v) and (not isinstance(v, (str, list)) or len(v) > 0)\n    return truthy(dataflows) or truthy(query) or truthy(keywords)","tryCatchPattern":"try:\n    res = meta.search_indicators(**filters)\nexcept OpenBBError as e:\n    if 'A query must be provided' in str(e):\n        raise ValueError('Enter a search term or pick a dataflow.') from e\n    raise","preventionTips":["Make at least one filter mandatory in UIs wrapping this search.","Use search_dataflows first for browsing, then search_indicators per dataflow.","Reject empty form submissions client-side."],"tags":["validation","imf","search","metadata","indicators"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}