streamlit/streamlit · error · StreamlitInvalidThemeOptionError
Theme option '{option_name}[{i}]' must be a string, got {typ
Error message
Theme option '{option_name}[{i}]' must be a string, got {type(color).__name__}: {color} What it means
Error "Theme option '{option_name}[{i}]' must be a string, got {type(color).__name__}: {color}" thrown in streamlit/streamlit.
Source
Thrown at lib/streamlit/config_util.py:277
empty values in the case of arrays.
Notes
-----
Logs warnings for potentially invalid colors, since more comprehensive
validation happens on the frontend.
"""
logger = _get_logger()
# Handle array color options (chartCategoricalColors, chartSequentialColors)
if isinstance(value, list):
if not value:
raise StreamlitInvalidThemeOptionError(
f"Theme option '{option_name}' cannot be an empty array"
)
for i, color in enumerate(value):
if not isinstance(color, str):
raise StreamlitInvalidThemeOptionError(
f"Theme option '{option_name}[{i}]' must be a string, got {type(color).__name__}: {color}"
)
color_str = color.strip()
if not color_str:
raise StreamlitInvalidThemeOptionError(
f"Theme option '{option_name}[{i}]' cannot be empty"
)
# Lightweight color validation with warning
if not is_css_color_like(color_str):
logger.warning(
"Theme option '%s[%s]' may be an invalid color: %s. "
"Expected formats: hex, rgb, and rgba colors",
option_name,
i,
color_str,
)View on GitHub (pinned to 202661fc55)
When it happens
Trigger: Thrown at lib/streamlit/config_util.py:277 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of streamlit/streamlit@202661fc55 (2026-08-26).
Data as JSON: /api/errors/4e14916d4cd4c9ac.
Report an issue: GitHub.