{"record":{"id":"a7f7a6c32a71d705","repo":"streamlit/streamlit","slug":"server-trusteduserheaders-had-multiple-mappings-fo","errorCode":null,"errorMessage":"server.trustedUserHeaders had multiple mappings for user key(s) {bad_keys}","messagePattern":"server\\.trustedUserHeaders had multiple mappings for user key\\(s\\) (.+?)","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"lib/streamlit/config.py","lineNumber":3203,"sourceCode":"                where_defined=trusted_user_headers.where_defined,\n            )\n        except json.JSONDecodeError as jde:\n            raise RuntimeError(\n                f\"bad JSON value for server.trustedUserHeaders: {jde.msg}\"\n            )\n\n    # Fetch the latest value, since we might've updated it from JSON.\n    final_config_value = options[\"server.trustedUserHeaders\"].value\n    # Ensure no user keys are duplicated.\n    values = set()\n    bad_keys = []\n    for user_key in final_config_value.values():\n        if user_key in values:\n            bad_keys.append(user_key)\n        values.add(user_key)\n\n    if bad_keys:\n        raise RuntimeError(\n            f\"server.trustedUserHeaders had multiple mappings for user key(s) {bad_keys}\"\n        )\n\n\n_RESERVED_METRICS_USER_ATTRIBUTES: Final = frozenset({\"type\"})\n# Valid OpenMetrics label name: ASCII letter/underscore followed by letters,\n# digits, or underscores. Attribute names become metric label names, so an\n# invalid name would emit malformed metrics.\n_METRICS_LABEL_NAME_RE: Final = re.compile(r\"^[a-zA-Z_][a-zA-Z0-9_]*$\")\n\n\ndef _check_metrics_user_attributes() -> None:\n    \"\"\"Validate server.unsafeMetricsUserAttributes at config-load time.\n\n    Rejects non-string entries, the reserved label name ``type`` (the event-type\n    discriminator on the user_session_events family, which a user attribute must\n    not shadow) and any name that is not a valid OpenMetrics label name (which\n    would otherwise produce malformed metrics on the endpoint).","sourceCodeStart":3185,"sourceCodeEnd":3221,"githubUrl":"https://github.com/streamlit/streamlit/blob/202661fc552db98c2ba0bb0e113d619689baf9de/lib/streamlit/config.py#L3185-L3221","documentation":"Error \"server.trustedUserHeaders had multiple mappings for user key(s) {bad_keys}\" thrown in streamlit/streamlit.","triggerScenarios":"Thrown at lib/streamlit/config.py:3203 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"202661fc552db98c2ba0bb0e113d619689baf9de","analyzedAt":"2026-08-26T09:13:21.291Z","schemaVersion":2},"datasetVersion":"2026-08-26T14:46:13.012Z"}