BerriAI/litellm · error · ValueError
Prometheus exclude configuration validation failed: {errors}
Error message
Prometheus exclude configuration validation failed:
{errors} What it means
Error "Prometheus exclude configuration validation failed: {errors}" thrown in BerriAI/litellm.
Source
Thrown at litellm/integrations/prometheus.py:738
from typing import get_args
import litellm
exclude_metrics: Final = frozenset(litellm.prometheus_exclude_metrics or ())
exclude_labels: Final = frozenset(litellm.prometheus_exclude_labels or ())
valid_metrics: Final = frozenset(get_args(DEFINED_PROMETHEUS_METRICS))
invalid_metrics: Final = sorted(exclude_metrics - valid_metrics)
valid_labels: Final = self._all_defined_labels()
invalid_labels: Final = sorted(exclude_labels - valid_labels)
errors: Final = (
*(f"Invalid metric name in prometheus_exclude_metrics: {metric}" for metric in invalid_metrics),
*(f"Invalid label name in prometheus_exclude_labels: {label}" for label in invalid_labels),
)
if errors:
raise ValueError("Prometheus exclude configuration validation failed:\n" + "\n".join(errors))
return exclude_metrics, exclude_labels
@staticmethod
def _all_defined_labels() -> frozenset[str]:
"""Every label a metric can emit: enum labels, hard-coded labels, and configured custom labels / tags."""
import litellm
builtin_labels: Final = frozenset(label.value for label in UserAPIKeyLabelNames)
custom_metadata_labels: Final = frozenset(
_sanitize_prometheus_label_name(label) for label in litellm.custom_prometheus_metadata_labels
)
custom_tag_labels: Final = frozenset(
_sanitize_prometheus_label_name(f"tag_{tag}") for tag in litellm.custom_prometheus_tags
)
return builtin_labels | _NON_ENUM_METRIC_LABELS | custom_metadata_labels | custom_tag_labels
def _validate_all_configurations(self, parsed_configs: list) -> ValidationResults:View on GitHub (pinned to 6c2dcb801b)
Solutions
- Fix the Prometheus exclude configuration errors listed in the message.
When it happens
Trigger: Thrown at litellm/integrations/prometheus.py:738 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/edf87ae54fe55136.
Report an issue: GitHub.