{"record":{"id":"507b3789ab003576","repo":"OpenBB-finance/OpenBB","slug":"failed-to-get-instruments-e-class-name","errorCode":null,"errorMessage":"Failed to get instruments -> {e.__class__.__name__}: {e}","messagePattern":"Failed to get instruments -> (.+?): (.+?)","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/deribit/openbb_deribit/utils/helpers.py","lineNumber":96,"sourceCode":"        )\n    if derivative_type and derivative_type not in DERIVATIVE_TYPES:\n        raise ValueError(\n            f\"Kind {derivative_type} not supported. Supported kinds are: {', '.join(DERIVATIVE_TYPES)}\"\n        )\n\n    url = f\"{BASE_URL}/api/v2/public/get_instruments?currency={currency.upper() if currency != 'all' else 'any'}\"\n\n    if derivative_type is not None:\n        url += f\"&kind={derivative_type}\"\n\n    if expired:\n        url += f\"&expired={str(expired).lower()}\"\n\n    try:\n        response = await amake_request(url)\n        return response.get(\"result\", [])  # type: ignore\n    except Exception as e:  # pylint: disable=broad-except\n        raise OpenBBError(\n            f\"Failed to get instruments -> {e.__class__.__name__}: {e}\"\n        ) from e\n\n\nasync def get_options_symbols(symbol: OptionsSymbols = \"BTC\") -> dict:\n    \"\"\"\n    Get a dictionary of contract symbols by expiry.\n\n    Parameters\n    ----------\n    symbol : OptionsSymbols\n        The underlying symbol to get options for. Default is \"btc\".\n\n    Returns\n    -------\n    dict[str, str]\n        A dictionary of contract symbols by expiry date.\n    \"\"\"","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/deribit/openbb_deribit/utils/helpers.py#L78-L114","documentation":"OpenBBError wrapping any exception raised by the amake_request call inside get_instruments, prefixed with the exception class name for diagnosability. Because get_instruments is @alru_cache(maxsize=64)-decorated, note that a successful (even empty) result is cached; only the raising path bypasses caching.","triggerScenarios":"DNS failure, connection timeout, TLS error, or a non-JSON response while GETting /api/v2/public/get_instruments. Raised before any result parsing, so it is purely transport-level.","commonSituations":"Offline environments, proxy interference, Deribit geo-blocking or rate limiting (HTTP 429/403 surfaces as an exception here), and outages.","solutions":["Test the URL directly: curl 'https://www.deribit.com/api/v2/public/get_instruments?currency=BTC'.","If the class name in the message is a timeout, increase patience or retry; if it's an HTTP error status, check for rate limiting/geo-blocks.","Configure proxy env vars (HTTP_PROXY/HTTPS_PROXY) in restricted networks.","Cache or persist instrument lists locally if you call this in a hot loop to avoid rate limits."],"exampleFix":"# before\ndata = await get_instruments(\"all\", \"future\")  # raises on first network blip\n\n# after\nfrom openbb_core.provider.utils.errors import OpenBBError\ntry:\n    data = await get_instruments(\"all\", \"future\")\nexcept OpenBBError as e:\n    logger.warning(\"instruments fetch failed, retrying once: %s\", e)\n    await asyncio.sleep(2)\n    data = await get_instruments(\"all\", \"future\")","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.errors import OpenBBError\ntry:\n    instruments = await get_instruments(\"all\", \"future\")\nexcept OpenBBError as e:\n    msg = str(e)\n    if \"Timeout\" in msg or \"timed out\" in msg:\n        await asyncio.sleep(2); instruments = await get_instruments(\"all\", \"future\")\n    else:\n        raise","preventionTips":["Read the exception class name embedded in the message to classify network vs API failure.","Cache instrument lists (the helper's own lru cache only caches successes).","Set proxy env vars behind corporate firewalls."],"tags":["deribit","network","transport","rate-limit","instruments"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}