VictoriaMetrics/VictoriaMetrics · error
cannot parse `dedup_interval: %q`: %w
Error message
cannot parse `dedup_interval: %q`: %w
What it means
The optional `dedup_interval` must itself be a valid Go duration. If cfg.DedupInterval is set but fails time.ParseDuration, the parse error is wrapped. It controls how duplicate samples within an interval are collapsed.
Source
Thrown at lib/streamaggr/streamaggr.go:494
}
interval, err := time.ParseDuration(cfg.Interval)
if err != nil {
return nil, fmt.Errorf("cannot parse `interval: %q`: %w", cfg.Interval, err)
}
if interval < time.Second {
return nil, fmt.Errorf("aggregation interval cannot be smaller than 1s; got %s", interval)
}
if opts == nil {
opts = &Options{}
}
// check cfg.DedupInterval
dedupInterval := opts.DedupInterval
if cfg.DedupInterval != "" {
di, err := time.ParseDuration(cfg.DedupInterval)
if err != nil {
return nil, fmt.Errorf("cannot parse `dedup_interval: %q`: %w", cfg.DedupInterval, err)
}
dedupInterval = di
}
if dedupInterval > interval {
return nil, fmt.Errorf("dedup_interval=%s cannot exceed interval=%s", dedupInterval, interval)
}
if dedupInterval > 0 && interval%dedupInterval != 0 {
return nil, fmt.Errorf("interval=%s must be a multiple of dedup_interval=%s", interval, dedupInterval)
}
// set the default staleness interval as the aggregation interval, to be consistent with query lookbehind window in metricsQL,
// see https://github.com/VictoriaMetrics/VictoriaMetrics/issues/11102
stalenessInterval := interval
if cfg.StalenessInterval != "" {
stalenessInterval, err = time.ParseDuration(cfg.StalenessInterval)
if err != nil {
return nil, fmt.Errorf("cannot parse `staleness_interval: %q`: %w", cfg.StalenessInterval, err)
}View on GitHub (pinned to 5079fb58f1)
Solutions
- Use a valid Go duration, e.g. `dedup_interval: 10s`.
- Always include a unit (s/m/h); bare numbers are invalid.
- Remove the option entirely if deduplication is not needed.
Example fix
// before dedup_interval: 10 // after dedup_interval: 10s
Defensive patterns
Strategy: validation
Validate before calling
if cfg.DedupInterval != "" {
if _, err := time.ParseDuration(cfg.DedupInterval); err != nil {
return fmt.Errorf("dedup_interval %q is not a Go duration like 10s", cfg.DedupInterval)
}
} Try / catch
as, err := streamaggr.LoadFromFile(path, pushFn, opts, alias)
if err != nil {
if strings.Contains(err.Error(), "cannot parse `dedup_interval") {
return fmt.Errorf("fix dedup_interval to a Go duration like 10s: %w", err)
}
return err
} Prevention
- Append a unit (s/m/h) to dedup_interval values.
- Pre-validate duration fields with time.ParseDuration.
- Remove dedup_interval if deduplication is not needed.
When it happens
Trigger: Config entry with `dedup_interval: 5` (missing unit), `dedup_interval: 5mins`, or any other unparseable duration string.
Common situations: Same duration-format mistakes as interval but on the dedup option; copy-paste leaving placeholder text in the value.
Understand the failure class
Background: "invalid duration" / "failed to parse duration": why your timeout, interval, or TTL string is rejected and which formats each library accepts — this error's family across 32 libraries.
Related errors
- cannot parse months from %q: %w
- cannot parse __scrape_interval__=%q: %w
- cannot parse __scrape_timeout__=%q: %w
- cannot parse `interval: %q`: %w
- dedup_interval=%s cannot exceed interval=%s
AI-assisted analysis of VictoriaMetrics/VictoriaMetrics@5079fb58f1 (2026-09-03).
Data as JSON: /api/errors/19eb8dcbc7156ca8.
Report an issue: GitHub.