BerriAI/litellm · error · ValueError
Configuration validation failed
Error message
Configuration validation failed:
{all_error_messages} What it means
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.
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
Example fix
# before (config)
litellm_settings:
prometheus:
labels:
litellm_proxy_total_requests: [end_user, requested_model] # wrong metric/labels
# after (config)
litellm_settings:
prometheus:
labels:
litellm_proxy_total_requests_metric: [end_user, requested_model, requested_model_group] Defensive patterns
Strategy: validation
Validate before calling
# Fail fast in CI/deploy before the proxy boots with a bad config
from litellm.integrations.prometheus import PrometheusCallback
try:
PrometheusCallback()._get_label_filters()
except ValueError as e:
print(e)
raise SystemExit('prometheus labels config invalid; fix before deploy') Try / catch
try:
callback = PrometheusCallback()
except ValueError as e:
logger.error('Prometheus config rejected: %s', e)
raise SystemExit(1) # do not serve with silently missing metrics Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- {label_error.message}
- Prometheus exclude configuration validation failed
- {error.message}
- bucket_name must be provided for GCS destination
- Custom code guardrail requires a guardrail_name
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/9445c03916d27770.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/prometheus.py:709
parsed_configs: Final = []
self.enabled_metrics = set()
for group_config in config:
if isinstance(group_config, dict):
parsed_config = PrometheusMetricsConfig(**group_config)
else:
parsed_config = group_config
parsed_configs.append(parsed_config)
self.enabled_metrics.update(parsed_config.metrics)
# Validate all configurations
validation_results: Final = self._validate_all_configurations(parsed_configs)
if validation_results.has_errors:
self._pretty_print_validation_errors(validation_results)
error_message = "Configuration validation failed:\n" + "\n".join(validation_results.all_error_messages)
raise ValueError(error_message)
# Build label filters from valid configurations
label_filters: Final = self._build_label_filters(parsed_configs)
# Pretty print the processed configuration
self._pretty_print_prometheus_config(label_filters)
return label_filters
def _parse_exclude_config(self) -> tuple[frozenset[str], frozenset[str]]:
"""Parse and validate the global ``exclude_metrics`` / ``exclude_labels`` settings."""
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))View on GitHub (pinned to 77b7c6c40c)