{"record":{"id":"16e7cd280bf64d5c","repo":"OpenBB-finance/OpenBB","slug":"valueerror-ve-ensure-the-data-format-matches-t","errorCode":null,"errorMessage":"ValueError: {ve}. Ensure the data format matches the expected format.","messagePattern":"ValueError: (.+?)\\. Ensure the data format matches the expected format\\.","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/core/openbb_core/app/model/obbject.py","lineNumber":275,"sourceCode":"                df.set_index(index, inplace=True)\n\n            # Drop columns that are all NaN, but don't rearrange columns\n            if sort_columns:\n                df.sort_index(axis=1, inplace=True)\n            df = df.dropna(axis=1, how=\"all\")\n\n            # Sort by specified column\n            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.\"","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/core/openbb_core/app/model/obbject.py#L257-L293","documentation":"Raised by the economic-indicators model validator when a symbol contains '::' but the identifier part (after strip) is empty. The check is `if not identifier` after `parts[1].strip()`, so trailing spaces don't help — 'IFS::' and 'IFS::   ' both fail. Companion error to the missing-separator check one branch above.","triggerScenarios":"`symbol='IFS::'` from f-string building where the identifier variable is empty (`f'{dataflow}::{code}'` with code=''), or a malformed user input with a stray '::'. A multi-symbol list fails on the first malformed token.","commonSituations":"Template/loop code where the code lookup returned nothing and the empty value is silently concatenated; string concatenation bugs dropping the second half; CSV symbol lists with trailing empty fields.","solutions":["Fix the source of the empty identifier — check the lookup that produced it.","Filter empty tokens before joining: `[s for s in symbols if s.split('::', 1)[-1].strip()]`.","Validate each token with a `dataflow::non-empty-identifier` regex before the call."],"exampleFix":"# before\nindicator = ''  # lookup returned nothing\nsymbol = f'IFS::{indicator}'\n\n# after\nindicator = lookup_indicator() or 'NGDP_XDC'\nsymbol = f'IFS::{indicator}'","handlingStrategy":"validation","validationCode":"def validate_symbol_identifiers(symbol: str) -> str:\n    for s in symbol.split(','):\n        left, sep, right = s.partition('::')\n        if sep and not right.strip():\n            raise ValueError(f'Symbol {s!r} has an empty identifier after ::')\n    return symbol\n\nsymbol = validate_symbol_identifiers(symbol)","typeGuard":"def symbol_has_identifier(s: str) -> bool:\n    left, sep, right = s.strip().partition('::')\n    return bool(sep and right.strip())","tryCatchPattern":null,"preventionTips":["After any f-string symbol build, assert the identifier half is non-empty.","Filter empty tokens out of symbol lists before joining them for the request."],"tags":["imf","openbb","validation","symbol","format","pydantic"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}