{"record":{"id":"951455ab8e14b292","repo":"OpenBB-finance/OpenBB","slug":"error-no-target-field-found","errorCode":null,"errorMessage":"Error: No {target} field found.","messagePattern":"Error: No (.+?) field found\\.","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/derivatives/openbb_derivatives/options/options_router.py","lineNumber":173,"sourceCode":"    elif isinstance(data, list):\n        if all(isinstance(d, dict) for d in data):\n            df = DataFrame(data)\n        elif all(isinstance(d, Data) for d in data):\n            df = DataFrame([d.model_dump(exclude_none=True, exclude_unset=True) for d in data])  # type: ignore\n\n    options = DataFrame(df.copy())\n\n    last_price = underlying_price or options.underlying_price.iloc[0]  # type: ignore\n\n    if last_price is None:\n        raise OpenBBError(\n            ValueError(\n                \"Last price must be provided for options filtering, and was not found in the data.\"\n            )\n        )\n\n    if target not in options.columns:  # type: ignore\n        raise OpenBBError(f\"Error: No {target} field found.\")\n    if \"dte\" not in options.columns:  # type: ignore\n        options.dte = (options.expiration - datetime.today().date()).days  # type: ignore\n\n    calls = options.query(f\"`option_type` == 'call' and `dte` >= 0 and `{target}` > 0\")  # type: ignore\n    puts = options.query(f\"`option_type` == 'put' and `dte` >= 0 and `{target}` > 0\")  # type: ignore\n\n    if oi:\n        calls = calls[calls[\"open_interest\"] > 0]\n        puts = puts[puts[\"open_interest\"] > 0]\n\n    if volume:\n        calls = calls[calls[\"volume\"] > 0]\n        puts = puts[puts[\"volume\"] > 0]\n\n    if dte_min is not None:\n        calls = calls.query(\"dte >= @dte_min\")  # type: ignore\n        puts = puts.query(\"dte >= @dte_min\")  # type: ignore\n","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/derivatives/openbb_derivatives/options/options_router.py#L155-L191","documentation":"Thrown by the options screening endpoint in openbb_derivatives when the `target` column (the metric to filter or rank strikes by, e.g. 'volume', 'open_interest', 'delta') is not present in the assembled options chains DataFrame. The router copies the provider data into a DataFrame and requires that the chosen target field exists as a column before it can query `\\`{target}\\` > 0`. It is wrapped in OpenBBError so it surfaces uniformly through the OBBject pipeline.","triggerScenarios":"Calling obb.derivatives.options.screen() (or the underlying filter logic) with target='gamma' when the fetched chains only contain delta/iv/volume/open_interest; using a target field name that the selected provider does not return; passing a custom Data model whose fields lack the target name.","commonSituations":"Provider-specific field availability (e.g. intrinio vs cboe vs tradier expose different greeks), typos in the target parameter, using an expired field name after a schema refactor, or filtering on a computed column that was never added to the DataFrame.","solutions":["Inspect the available columns first: run res = obb.derivatives.options.chains(symbol, provider); print(res.to_df().columns) and pick a target from that list.","Pass a target that is universally present, such as 'volume' or 'open_interest', or request a provider/quote that returns the greek you need.","Correct typos in the target parameter (it is case-sensitive snake_case, e.g. 'open_interest' not 'OpenInterest').","If using the Python function directly with a custom DataFrame, ensure the column exists before calling the router."],"exampleFix":"# before\nres = obb.derivatives.options.screen(symbol='AAPL', target='gamma', provider='cboe')  # gamma not returned\n\n# after\ndf = obb.derivatives.options.chains('AAPL', provider='cboe').to_df()\nprint(df.columns)  # pick an existing column, e.g. 'delta'\nres = obb.derivatives.options.screen(symbol='AAPL', target='delta', provider='cboe')","handlingStrategy":"validation","validationCode":"from openbb import obb\nres = obb.derivatives.options.chains('AAPL', provider='cboe')\ncols = set(res.to_df().columns)\ntarget = 'delta'\nassert target in cols, f'target {target!r} not in {sorted(cols)}'","typeGuard":"def has_target_column(df, target: str) -> bool:\n    \"\"\"True if the chains DataFrame exposes the target metric column.\"\"\"\n    return isinstance(df, object) and hasattr(df, 'columns') and target in df.columns","tryCatchPattern":"from openbb_core.app.model.abstract.error import OpenBBError\ntry:\n    res = obb.derivatives.options.screen(symbol='AAPL', target=target)\nexcept OpenBBError as e:\n    if 'No' in str(e) and 'field found' in str(e):\n        # pick a fallback target that exists in the data\n        ...","preventionTips":["Always list res.to_df().columns before choosing the target parameter.","Prefer universally available targets like 'volume' or 'open_interest'.","Pin provider versions so returned field sets stay stable."],"tags":["options","pandas","validation","column-missing"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}