{"record":{"id":"3622f8d5182d991d","repo":"OpenBB-finance/OpenBB","slug":"an-unexpected-error-occurred-ex","errorCode":null,"errorMessage":"An unexpected error occurred: {ex}","messagePattern":"An unexpected error occurred: (.+?)","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/core/openbb_core/app/model/obbject.py","lineNumber":283,"sourceCode":"            if sort_by:\n                df.sort_values(\n                    by=sort_by,\n                    ascending=ascending if ascending is not None else True,\n                    inplace=True,\n                )\n\n        except OpenBBError as e:\n            raise e\n        except ValueError as ve:\n            raise OpenBBError(\n                f\"ValueError: {ve}. Ensure the data format matches the expected format.\"\n            ) from ve\n        except TypeError as te:\n            raise OpenBBError(\n                f\"TypeError: {te}. Check the data types in your results.\"\n            ) from te\n        except Exception as ex:\n            raise OpenBBError(f\"An unexpected error occurred: {ex}\") from ex\n\n        return df\n\n    def to_polars(self) -> \"PolarsDataFrame\":  # type: ignore\n        \"\"\"Convert results field to polars dataframe.\"\"\"\n        try:\n            from polars import from_pandas  # type: ignore # pylint: disable=import-outside-toplevel\n        except ImportError as exc:\n            raise ImportError(\n                \"Please install polars: `pip install polars pyarrow`  to use this method.\"\n            ) from exc\n\n        return from_pandas(self.to_dataframe(index=None))\n\n    def to_numpy(self) -> \"ndarray\":\n        \"\"\"Convert results field to numpy array.\"\"\"\n        return self.to_dataframe(index=None).to_numpy()\n","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/core/openbb_core/app/model/obbject.py#L265-L301","documentation":"Raised by the economic-indicators model validator when more than one table symbol is present in the request. Table mode is hard-wired for a single dataflow/table (`tables[0]` is used exclusively), so a second table would be silently dropped if allowed — the validator rejects instead.","triggerScenarios":"`symbol='STA::H_CPI,STA::H_PCH'` (two H_ tables), or two hierarchy IDs from the same/different dataflows. Mixing one table with indicators hits the sibling error instead.","commonSituations":"Iterating over 'all presentation tables' in one call; user multi-select of tables in a UI; assuming tables batch like indicators do.","solutions":["Issue one request per table and concatenate results client-side.","For many tables, loop over `PRESENTATION_TABLES`/list_tables() entries sequentially.","If you need multiple indicators (not tables) in one call, use plain indicator symbols together — that is supported."],"exampleFix":"# before\nres = obb.economy.economic_indicators(provider='imf', symbol='STA::H_CPI,STA::H_PCH', country='USA')\n\n# after\nresults = [obb.economy.economic_indicators(provider='imf', symbol=s, country='USA') for s in ['STA::H_CPI', 'STA::H_PCH']]","handlingStrategy":"validation","validationCode":"def validate_single_table(symbol: str) -> str:\n    tables = [s.strip() for s in symbol.split(',') if s.strip().split('::', 1)[-1].startswith('H_')]\n    if len(tables) > 1:\n        raise ValueError(f'Only one table per request; got {tables}. Split into separate calls.')\n    return symbol","typeGuard":"def is_single_table_request(symbol: str) -> bool:\n    tables = [s for s in symbol.split(',') if s.strip().split('::', 1)[-1].startswith('H_')]\n    return len(tables) <= 1","tryCatchPattern":null,"preventionTips":["Loop over tables one request at a time and merge results client-side.","Remember multiple plain indicators in one request ARE supported — the one-per-request rule applies to tables only."],"tags":["imf","openbb","validation","symbol","table","pydantic"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}