{"record":{"id":"22aadffd6e8cb912","repo":"OpenBB-finance/OpenBB","slug":"price-field-not-found-in-the-data","errorCode":null,"errorMessage":"Price field not found in the data.","messagePattern":"Price field not found in the data\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/derivatives/openbb_derivatives/derivatives_views.py","lineNumber":105,"sourceCode":"            elif isinstance(data, (list, Data)):\n                df = DataFrame([d.model_dump(exclude_none=True, exclude_unset=True) for d in data])  # type: ignore\n            else:\n                pass\n        else:\n            df = DataFrame(\n                [d.model_dump(exclude_none=True, exclude_unset=True) for d in kwargs[\"obbject_item\"]]  # type: ignore\n                if isinstance(kwargs.get(\"obbject_item\"), list)\n                else kwargs[\"obbject_item\"].model_dump(exclude_none=True, exclude_unset=True)  # type: ignore\n            )\n\n        if df.empty:\n            raise OpenBBError(\"Error: No data to plot.\")\n\n        if \"expiration\" not in df.columns:\n            raise OpenBBError(\"Expiration field not found in the data.\")\n\n        if \"price\" not in df.columns:\n            raise ValueError(\"Price field not found in the data.\")\n\n        provider = kwargs.get(\"provider\", \"\")\n\n        if provider != \"deribit\":\n            df[\"expiration\"] = df[\"expiration\"].apply(to_datetime).dt.strftime(\"%b-%Y\")\n\n        if (\n            provider == \"cboe\"\n            and \"date\" in df.columns\n            and len(df[\"date\"].unique()) > 1\n            and \"symbol\" in df.columns\n        ):\n            df[\"expiration\"] = df.symbol\n\n        # Use a complete list of expirations to categorize the x-axis across all dates.\n        expirations = df[\"expiration\"].unique().tolist()\n\n        # Use the supplied colors, if any.","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/derivatives/openbb_derivatives/derivatives_views.py#L87-L123","documentation":"Raised (as a plain ValueError, wrapped by OpenBB's error handling) by the derivatives futures curve charting view when the DataFrame lacks a 'price' column. Price is the y-value of the curve; expiration was present but price was not, indicating malformed or wrong-shape input data.","triggerScenarios":"Calling the futures curve chart with records that have 'expiration' but no 'price' field - e.g. a payload with 'close'/'last' instead of 'price', or Data models where price was None and got dropped by exclude_none.","commonSituations":"Custom DataFrames using provider-native column names ('close', 'settlement') instead of the standardized 'price'; model_dump(exclude_none=True) stripping a None price on a holiday row; joining in user code that drops the column.","solutions":["Rename your price-like column: df = df.rename(columns={'close': 'price'}) (or 'settlement'/'last').","Ensure price values are non-None so exclude_none serialization keeps them.","Use the standardized curve endpoint output instead of raw provider payloads.","Pre-check both required columns: {'expiration', 'price'} <= set(df.columns)."],"exampleFix":"# before\nfig = charting.show(data=df)  # df has 'close' not 'price'\n\n# after\ndf = df.rename(columns={'close': 'price'})\nfig = charting.show(data=df)","handlingStrategy":"validation","validationCode":"df = <your frame>\nif 'price' not in df.columns:\n    for alt in ('close', 'last', 'settlement'):\n        if alt in df.columns:\n            df = df.rename(columns={alt: 'price'})\n            break\nassert 'price' in df.columns, 'curve chart requires price'","typeGuard":"def curve_ready(df) -> bool:\n    return not df.empty and {'expiration', 'price'} <= set(df.columns)","tryCatchPattern":"try:\n    fig, content = derivatives_futures_curve(**kwargs)\nexcept ValueError as e:\n    if 'Price field not found' in str(e):\n        kwargs['data'] = kwargs['data'].rename(columns={'close': 'price'})\n        fig, content = derivatives_futures_curve(**kwargs)","preventionTips":["Standardize on 'price' as the column name before charting.","Avoid exclude_none dumps that can strip None prices from holiday rows."],"tags":["openbb","charting","futures","schema"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}