{"record":{"id":"a337ab1c2f225dde","repo":"OpenBB-finance/OpenBB","slug":"invalid-deribit-symbol-symbol-supported-symbol-a337ab","errorCode":null,"errorMessage":"Invalid Deribit symbol: {symbol}. Supported symbols are: {', '.join(all_symbols)}","messagePattern":"Invalid Deribit symbol: (.+?)\\. Supported symbols are: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/deribit/openbb_deribit/models/futures_historical.py","lineNumber":61,"sourceCode":"        # 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        if not v:\n            raise ValueError(\"Symbol is required.\")\n\n        futures_symbols = run_async(get_futures_symbols)\n        perpetual_symbols = run_async(get_perpetual_symbols)\n        all_symbols = list(perpetual_symbols) + futures_symbols\n        symbols = v.upper().split(\",\")\n        new_symbols: list = []\n\n        for symbol in symbols:\n            if symbol not in all_symbols:\n                raise ValueError(\n                    f\"Invalid Deribit symbol: {symbol}. Supported symbols are: {', '.join(all_symbols)}\"\n                )\n            if symbol in perpetual_symbols:\n                new_symbols.append(perpetual_symbols[symbol])\n            else:\n                new_symbols.append(symbol)\n\n        return \",\".join(new_symbols)\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def _validate_model(cls, values):\n        \"\"\"Validate the model.\"\"\"\n        interval = values.get(\"interval\")\n        now = datetime.today()\n\n        if not values.get(\"start_date\"):\n            if interval == \"1m\":","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/deribit/openbb_deribit/models/futures_historical.py#L43-L79","documentation":"Raised by the field_validator on DeribitFuturesHistoricalQueryParams.symbol when a requested symbol is not in the combined set of live Deribit perpetual and futures instrument names. Note the validator itself performs two run_async network fetches (get_futures_symbols, get_perpetual_symbols), so the valid set is the exchange's current listing, not a static list. Perpetual aliases (e.g. 'BTC') are mapped to full instrument names after validation.","triggerScenarios":"Calling futures historical with a symbol like 'DOGE_PERPETUAL' (not listed), a typo'd or expired future contract name, or a lowercase name is fine (it is .upper()ed) but an unknown one fails. Because the valid list comes from live API calls, running the validator offline makes the symbol fetch itself fail rather than validate.","commonSituations":"Users copying symbols from other venues (Binance 'BTCUSDT' style), using delisted/expired contracts, or running in an environment where Deribit is unreachable so the dynamic list cannot be fetched.","solutions":["Use a currently listed Deribit instrument name (e.g. 'BTC-PERPETUAL', 'ETH-PERPETUAL', or an active dated future like 'BTC-27JUN26') or a perpetual short symbol such as 'BTC'.","List valid symbols first via the Deribit instruments endpoint (openbb_deribit.utils.helpers.get_instruments('all','future')) and pick from that result.","Remove expired contracts from your symbol list; Deribit delists them and they disappear from the valid set.","If every symbol fails, check network access to deribit.com — the validator fetches the symbol list synchronously at validation time."],"exampleFix":"# before\nobb.derivatives.futures.historical(symbol=\"BTCUSDT\", provider=\"deribit\")\n\n# after\nobb.derivatives.futures.historical(symbol=\"BTC-PERPETUAL\", provider=\"deribit\")","handlingStrategy":"validation","validationCode":"from openbb_deribit.utils.helpers import get_instruments\nimport asyncio\n\nvalid = {d[\"instrument_name\"] for d in asyncio.run(get_instruments(\"all\", \"future\"))}\nrequested = [s.strip().upper() for s in \"BTC-PERPETUAL,BTCUSDT\".split(\",\")]\nbad = [s for s in requested if s not in valid]\nassert not bad, f\"Unknown symbols: {bad}; pick from the exchange's live list\"","typeGuard":"def is_valid_deribit_future(symbol: str, valid: set[str]) -> bool:\n    \"\"\"True if symbol is a currently listed Deribit futures instrument name.\"\"\"\n    return isinstance(symbol, str) and symbol.strip().upper() in valid","tryCatchPattern":"from pydantic import ValidationError\ntry:\n    obb.derivatives.futures.historical(symbol=sym, provider=\"deribit\")\nexcept ValidationError as e:\n    if \"Invalid Deribit symbol\" in str(e):\n        log_bad_symbol(sym)  # refresh instrument list, correct symbol\n    raise","preventionTips":["Derive symbol lists from get_instruments at runtime instead of hardcoding them.","Uppercase and trim symbols before passing them in.","Periodically refresh cached lists — Deribit rolls dated contracts."],"tags":["deribit","validation","symbol","futures","input-validation"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}