OpenBB-finance/OpenBB · error · ValueError
{k} is not a valid indicator.
Error message
{k} is not a valid indicator. What it means
ChartIndicators (obbject_extensions/charting/query_params.py:851) is a Pydantic model whose keys are TA indicator names; its mode="before" validator rejects any key not present in ChartIndicators.get_available_indicators(), raising ValueError(f"{k} is not a valid indicator."). This is the input gate for the `indicators` dict passed to charting endpoints.
Source
Thrown at openbb_platform/obbject_extensions/charting/openbb_charting/query_params.py:851
def __repr__(self):
"""Return the string representation of the model."""
fields = self.__class__.model_fields
repr_str = "\n" + "\n".join(
[
f"{str(v.description).replace('IndicatorsQueryParams', ':').replace('ADOs', 'AD Os')}"
for k, v in fields.items()
]
)
return repr_str
@model_validator(mode="before")
@classmethod
def validate_model(cls, values):
"""Validate the model."""
indicators = list(ChartIndicators.get_available_indicators())
for k, v in values.items():
if k not in indicators:
raise ValueError(f"{k} is not a valid indicator.")
return values
View on GitHub (pinned to 3e071fcc2c)
Solutions
- Validate keys against the source of truth before building the model: set(indicators) <= set(ChartIndicators.get_available_indicators()).
- Remove or correct the offending key named in the message.
- Print ChartIndicators.get_available_indicators() to see the exact accepted spellings for your installed version.
- Upgrade/align the openbb-charting package if the indicator you need exists in a newer release.
Example fix
# before
indicators = {"sma": {"length": 20}, "supertrend": {}}
charting.to_chart(data=df, indicators=indicators) # ValueError: supertrend is not a valid indicator.
# after
valid = set(ChartIndicators.get_available_indicators())
indicators = {k: v for k, v in {"sma": {"length": 20}, "supertrend": {}}.items() if k in valid}
charting.to_chart(data=df, indicators=indicators) Defensive patterns
Strategy: validation
Validate before calling
from openbb_charting.query_params import ChartIndicators
allowed = set(ChartIndicators.get_available_indicators())
bad = set(indicators) - allowed
if bad:
raise ValueError(f"unsupported indicators: {sorted(bad)}; allowed: {sorted(allowed)}")
model = ChartIndicators.model_validate(indicators) Type guard
def valid_indicator_keys(payload: dict) -> bool:
from openbb_charting.query_params import ChartIndicators
return set(payload) <= set(ChartIndicators.get_available_indicators()) Try / catch
from pydantic import ValidationError
try:
model = ChartIndicators.model_validate(indicators)
except ValidationError as e:
bad = [err["loc"][0] for err in e.errors()]
indicators = {k: v for k, v in indicators.items() if k not in bad}
model = ChartIndicators.model_validate(indicators) Prevention
- Source indicator keys from ChartIndicators.get_available_indicators() for the installed version.
- Validate user/config-supplied dicts before passing them to charting endpoints.
- Re-check the allowed list after upgrading openbb-charting.
When it happens
Trigger: Passing indicators={"macd": True, "vwap": True, "supertrend": {}} where one key (e.g. "supertrend") is not in the available set; or a typo like "rsi " with trailing whitespace.
Common situations: Copy-pasting pandas_ta indicator names that OpenBB hasn't mapped; dicts built from user input or config files without validation; version drift after upgrading openbb-charting changes the supported list.
Related errors
- Trace '{trace}' not found
- Label must be specified
- Unknown indicator: {indicator}
- At least one extension type must be selected.
- Incorrect email or password
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/538e07624ae6101f.
Report an issue: GitHub.