{"record":{"id":"9445c03916d27770","repo":"BerriAI/litellm","slug":"configuration-validation-failed-all-error-messag","errorCode":null,"errorMessage":"Configuration validation failed:\n{all_error_messages}","messagePattern":"Configuration validation failed:\n(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/prometheus.py","lineNumber":709,"sourceCode":"        parsed_configs: Final = []\n        self.enabled_metrics = set()\n\n        for group_config in config:\n            if isinstance(group_config, dict):\n                parsed_config = PrometheusMetricsConfig(**group_config)\n            else:\n                parsed_config = group_config\n\n            parsed_configs.append(parsed_config)\n            self.enabled_metrics.update(parsed_config.metrics)\n\n        # Validate all configurations\n        validation_results: Final = self._validate_all_configurations(parsed_configs)\n\n        if validation_results.has_errors:\n            self._pretty_print_validation_errors(validation_results)\n            error_message = \"Configuration validation failed:\\n\" + \"\\n\".join(validation_results.all_error_messages)\n            raise ValueError(error_message)\n\n        # Build label filters from valid configurations\n        label_filters: Final = self._build_label_filters(parsed_configs)\n\n        # Pretty print the processed configuration\n        self._pretty_print_prometheus_config(label_filters)\n        return label_filters\n\n    def _parse_exclude_config(self) -> tuple[frozenset[str], frozenset[str]]:\n        \"\"\"Parse and validate the global ``exclude_metrics`` / ``exclude_labels`` settings.\"\"\"\n        from typing import get_args\n\n        import litellm\n\n        exclude_metrics: Final = frozenset(litellm.prometheus_exclude_metrics or ())\n        exclude_labels: Final = frozenset(litellm.prometheus_exclude_labels or ())\n\n        valid_metrics: Final = frozenset(get_args(DEFINED_PROMETHEUS_METRICS))","sourceCodeStart":691,"sourceCodeEnd":727,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/prometheus.py#L691-L727","documentation":"During Prometheus metrics setup, litellm parses every metric/label group config into parsed_configs, validates them all with _validate_all_configurations, and if any errors were collected it pretty-prints them (rich panels/tables) and raises this ValueError joining all error messages. The raise aborts label-filter construction, which normally means the prometheus callback fails to initialize and, in the proxy, startup dies.","triggerScenarios":"Configuring prometheus label filters (litellm_settings prometheus labels config / per-metric group syntax like 'metric: [labels]') with a misspelled metric key, a label not valid for that metric, malformed syntax that parses to something unexpected, or duplicate/conflicting group entries.","commonSituations":"Copying a labels config from an older litellm release whose metric or label names have since changed; YAML typos; using a custom label without registering it via litellm.custom_prometheus_metadata_labels; expecting end_user/tags on a metric that does not expose them.","solutions":["Read the rich panel printed just above the exception — it enumerates every invalid metric/label combination with the valid alternatives","Fix each entry so metric names come from DEFINED_PROMETHEUS_METRICS and labels come from that metric's allowed set","Register custom metadata labels via litellm.custom_prometheus_metadata_labels (and custom tags) before referencing them","Add a CI/deploy step that constructs the prometheus config to catch breakage before rollout"],"exampleFix":"# before (config)\nlitellm_settings:\n  prometheus:\n    labels:\n      litellm_proxy_total_requests: [end_user, requested_model]  # wrong metric/labels\n\n# after (config)\nlitellm_settings:\n  prometheus:\n    labels:\n      litellm_proxy_total_requests_metric: [end_user, requested_model, requested_model_group]","handlingStrategy":"validation","validationCode":"# Fail fast in CI/deploy before the proxy boots with a bad config\nfrom litellm.integrations.prometheus import PrometheusCallback\ntry:\n    PrometheusCallback()._get_label_filters()\nexcept ValueError as e:\n    print(e)\n    raise SystemExit('prometheus labels config invalid; fix before deploy')","typeGuard":null,"tryCatchPattern":"try:\n    callback = PrometheusCallback()\nexcept ValueError as e:\n    logger.error('Prometheus config rejected: %s', e)\n    raise SystemExit(1)  # do not serve with silently missing metrics","preventionTips":["Validate the prometheus labels config in CI by constructing the callback","Read the rich panel output — it lists every invalid pair with valid alternatives","Re-validate whenever upgrading litellm since metric/label inventories change"],"tags":["prometheus","metrics","config","validation","labels"],"backgroundTag":"invalid-config-value","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}