streamlit/streamlit · error · RuntimeError
server.trustedUserHeaders had multiple mappings for user key
Error message
server.trustedUserHeaders had multiple mappings for user key(s) {bad_keys} What it means
Error "server.trustedUserHeaders had multiple mappings for user key(s) {bad_keys}" thrown in streamlit/streamlit.
Source
Thrown at lib/streamlit/config.py:3203
where_defined=trusted_user_headers.where_defined,
)
except json.JSONDecodeError as jde:
raise RuntimeError(
f"bad JSON value for server.trustedUserHeaders: {jde.msg}"
)
# Fetch the latest value, since we might've updated it from JSON.
final_config_value = options["server.trustedUserHeaders"].value
# Ensure no user keys are duplicated.
values = set()
bad_keys = []
for user_key in final_config_value.values():
if user_key in values:
bad_keys.append(user_key)
values.add(user_key)
if bad_keys:
raise RuntimeError(
f"server.trustedUserHeaders had multiple mappings for user key(s) {bad_keys}"
)
_RESERVED_METRICS_USER_ATTRIBUTES: Final = frozenset({"type"})
# Valid OpenMetrics label name: ASCII letter/underscore followed by letters,
# digits, or underscores. Attribute names become metric label names, so an
# invalid name would emit malformed metrics.
_METRICS_LABEL_NAME_RE: Final = re.compile(r"^[a-zA-Z_][a-zA-Z0-9_]*$")
def _check_metrics_user_attributes() -> None:
"""Validate server.unsafeMetricsUserAttributes at config-load time.
Rejects non-string entries, the reserved label name ``type`` (the event-type
discriminator on the user_session_events family, which a user attribute must
not shadow) and any name that is not a valid OpenMetrics label name (which
would otherwise produce malformed metrics on the endpoint).View on GitHub (pinned to 202661fc55)
When it happens
Trigger: Thrown at lib/streamlit/config.py:3203 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/a7f7a6c32a71d705.
Report an issue: GitHub.