BerriAI/litellm · error · ValueError
Invalid labels for metric '{metric_name}': {invalid_labels}
Error message
Invalid labels for metric '{metric_name}': {invalid_labels} What it means
Error "Invalid labels for metric '{metric_name}': {invalid_labels}" thrown in BerriAI/litellm.
Source
Thrown at litellm/integrations/prometheus.py:832
if self._validate_single_metric_name(metric_name) is None:
label_filters[metric_name] = config.include_labels
return label_filters
def _validate_configured_metric_labels(self, metric_name: str, labels: list[str]):
"""
Ensure that all the configured labels are valid for the metric
Raises ValueError if the metric labels are invalid and pretty prints the error
"""
label_error: Final = self._validate_single_metric_labels(metric_name, labels)
if label_error:
self._pretty_print_invalid_labels_error(
metric_name=label_error.metric_name,
invalid_labels=label_error.invalid_labels,
valid_labels=label_error.valid_labels,
)
raise ValueError(label_error.message)
return True
#########################################################
# Pretty print functions
#########################################################
def _pretty_print_validation_errors(self, validation_results: ValidationResults) -> None:
"""Pretty print all validation errors using rich"""
try:
from rich.console import Console
from rich.panel import Panel
from rich.table import Table
from rich.text import Text
console: Final = Console()
# Create error panel titleView on GitHub (pinned to 6c2dcb801b)
Solutions
- Use only valid label names for the metric.
When it happens
Trigger: Thrown at litellm/integrations/prometheus.py:832 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/22307999621bc906.
Report an issue: GitHub.