vectordotdev/vector · error
Invalid cache settings
Error message
Invalid cache settings: {e:?} What it means
MetricNormalizer::with_config panics when NormalizerConfig::validate() rejects the cache settings. The normalizer maintains a MetricSet whose cache parameters (e.g. cache_*, diff/decay windows) must be internally consistent; invalid values are treated as a programmer/config error rather than a runtime condition. The panic message carries the Debug-formatted validation error.
Solutions
- Read the {e:?} payload to see which validation rule failed and correct the offending cache setting
- Check the config values feeding NormalizerConfig (durations must be positive and within allowed bounds)
- If driven by TOML/YAML config, fix the corresponding sink option and re-run vector validate
Defensive patterns
Strategy: validation
Validate before calling
let config = NormalizerConfig { cache_duration: Duration::from_secs(60), ..Default::default() };
config.validate().expect("normalizer cache settings must pass validation"); Try / catch
// If constructing programmatically, validate first instead of panicking:
match config.validate() {
Ok(c) => MetricNormalizer::with_config(normalizer, c),
Err(e) => return Err(anyhow!("invalid normalizer settings: {e:?}")),
} Prevention
- Always run NormalizerConfig::validate() before with_config
- Use Default::default() as the base and override individual fields
- Keep cache durations positive and within documented bounds
When it happens
Trigger: Constructing a MetricNormalizer (directly or via a metrics sink like prometheus_exporter) with a NormalizerConfig whose settings fail validate() — e.g. cache duration zero/negative or out-of-range values set programmatically.
Common situations: Embedding Vector's metric normalization library in custom code with hand-built NormalizerConfig values; malformed sink options that parse into invalid numeric settings.
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
- Integration has no environments
- Invalid `ack_decoding` config.
- metrics initialization failed
- Metrics must be initialized
- time ewma gauge mutex poisoned
AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/82bec87884e9a296.
Report an issue: GitHub.
Appendix: source
Thrown at src/sinks/util/buffer/metrics/normalize.rs:154
/// A self-contained metric normalizer.
///
/// The normalization state is stored internally, and it can only be created from a normalizer implementation that is
/// either `Default` or is constructed ahead of time, so it is primarily useful for constructing a usable normalizer
/// via implicit conversion methods or when no special parameters are required for configuring the underlying normalizer.
pub struct MetricNormalizer<N> {
state: MetricSet,
normalizer: N,
}
impl<N> MetricNormalizer<N> {
/// Creates a new normalizer with the given configuration.
pub fn with_config<D: NormalizerSettings + Clone>(
normalizer: N,
config: NormalizerConfig<D>,
) -> Self {
let settings = config
.validate()
.unwrap_or_else(|e| panic!("Invalid cache settings: {e:?}"))
.into_settings();
Self {
state: MetricSet::new(settings),
normalizer,
}
}
/// Creates a new normalizer with a time-to-live policy.
pub fn with_ttl(normalizer: N, ttl: Duration) -> Self {
Self {
state: MetricSet::with_policies(None, Some(TtlPolicy::new(ttl))),
normalizer,
}
}
/// Gets a mutable reference to the current metric state for this normalizer.
pub const fn get_state_mut(&mut self) -> &mut MetricSet {
&mut self.stateView on GitHub (pinned to bdb87aeaa4)