{"record":{"id":"65894b3d939ea70e","repo":"OpenBB-finance/OpenBB","slug":"invalid-symbol-s-valid-symbols-are-all-symbo","errorCode":null,"errorMessage":"Invalid symbol: {s}. Valid symbols are: {all_symbols}","messagePattern":"Invalid symbol: (.+?)\\. Valid symbols are: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/deribit/openbb_deribit/models/futures_info.py","lineNumber":53,"sourceCode":"    @classmethod\n    def _validate_symbol(cls, v):\n        \"\"\"Validate the symbol.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from openbb_core.provider.utils.helpers import run_async\n        from openbb_deribit.utils.helpers import (\n            get_futures_symbols,\n            get_perpetual_symbols,\n        )\n\n        symbols = v.split(\",\")\n        new_symbols: list = []\n        perpetual_symbols = run_async(get_perpetual_symbols)\n        futures_symbols = run_async(get_futures_symbols)\n        all_symbols = futures_symbols + list(perpetual_symbols)\n\n        for s in symbols:\n            if s not in all_symbols:\n                raise ValueError(\n                    f\"Invalid symbol: {s}. Valid symbols are: {all_symbols}\"\n                )\n            if s in perpetual_symbols:\n                new_symbols.append(perpetual_symbols[s])\n            else:\n                new_symbols.append(s)\n\n        return \",\".join(new_symbols)\n\n\nclass DeribitFuturesInfoData(FuturesInfoData):\n    \"\"\"Deribit Futures Info Data.\"\"\"\n\n    __alias_dict__ = {\n        \"symbol\": \"instrument_name\",\n        \"change_percent\": \"price_change\",\n    }\n    model_config = ConfigDict(extra=\"ignore\")","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/deribit/openbb_deribit/models/futures_info.py#L35-L71","documentation":"ValueError from the symbol field_validator in DeribitFuturesInfoQueryParams. Symbols are validated against the live union of Deribit futures instrument names plus perpetual short-symbol keys (fetched with run_async at validation time), and each must appear there before perpetuals are expanded to full instrument names. Unlike the historical model, this validator does NOT call .upper(), so case matters.","triggerScenarios":"Passing lowercase symbols ('btc'), exchange-agnostic tickers ('BTCUSDT'), or expired futures contract names to the futures info endpoint. The dynamic list fetch also means a network failure surfaces during validation.","commonSituations":"Reusing symbol strings from other OpenBB providers where symbols are lowercase, typing Binance-style pairs, or referencing expired contracts after Deribit rolls them.","solutions":["Pass uppercase Deribit instrument names, e.g. 'BTC-PERPETUAL' or 'ETH-PERPETUAL'; this validator does not uppercase input.","For multiple symbols, pass a comma-separated uppercase list like 'BTC-PERPETUAL,ETH-PERPETUAL'.","Discover currently valid names via get_instruments('all', 'future') or the futures instruments endpoint.","Check connectivity if validation itself hangs — the valid list is fetched live."],"exampleFix":"# before\nobb.derivatives.futures.info(symbol=\"btc\", provider=\"deribit\")\n\n# after\nobb.derivatives.futures.info(symbol=\"BTC-PERPETUAL\", provider=\"deribit\")","handlingStrategy":"validation","validationCode":"from openbb_deribit.utils.helpers import get_instruments\nvalid = {d[\"instrument_name\"] for d in asyncio.run(get_instruments(\"all\", \"future\"))}\nsymbols = [s.strip() for s in raw_input.split(\",\")]\nassert all(s and s == s.upper() and s in valid for s in symbols), \"use uppercase live instrument names\"","typeGuard":"def is_deribit_futures_symbol(s: str, valid: set[str]) -> bool:\n    return isinstance(s, str) and s in valid  # case-sensitive: must be uppercase","tryCatchPattern":"from pydantic import ValidationError\ntry:\n    obb.derivatives.futures.info(symbol=s, provider=\"deribit\")\nexcept ValidationError as e:\n    if \"Invalid symbol\" in str(e):\n        s = s.upper()  # most common fix, then retry once\n        obb.derivatives.futures.info(symbol=s, provider=\"deribit\")","preventionTips":["This validator is case-sensitive — always .upper() symbols before passing.","Source symbols from get_instruments output verbatim.","Validate comma-separated lists element-wise before the call."],"tags":["deribit","validation","symbol","case-sensitivity","futures"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}