AdguardTeam/AdGuardHome · error

unsupported interval: %w

Error message

unsupported interval: %w

What it means

StatsCtx.New rejects the configured stats interval (Limit) because validateIvl considers it unsupported; the underlying validation error is wrapped as 'unsupported interval'.

Source

Thrown at internal/stats/stats.go:160

	// filename is the name of database file.
	filename string

	// limit is an upper limit for collecting statistics.
	limit time.Duration

	// enabled tells if the statistics are enabled.
	enabled bool
}

// New creates s from conf and properly initializes it.  Don't use s before
// calling it's Start method.
func New(conf Config) (s *StatsCtx, err error) {
	defer withRecovered(&err)

	err = validateIvl(conf.Limit)
	if err != nil {
		return nil, fmt.Errorf("unsupported interval: %w", err)
	}

	if conf.ShouldCountClient == nil {
		return nil, errors.Error("should count client is unspecified")
	}

	s = &StatsCtx{
		logger:         conf.Logger,
		currMu:         &sync.RWMutex{},
		httpReg:        conf.HTTPReg,
		configModifier: conf.ConfigModifier,
		filename:       conf.Filename,

		confMu:            &sync.RWMutex{},
		ignored:           conf.Ignored,
		shouldCountClient: conf.ShouldCountClient,
		limit:             conf.Limit,
		enabled:           conf.Enabled,

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Set Config.Limit to a supported interval, typically a whole number of hours within the min/max window
  2. Check validateIvl's bounds in internal/stats and align the config
  3. Fail fast at config load with a clear message

Example fix

// before
conf := stats.Config{Limit: 30 * time.Minute}
// after
conf := stats.Config{Limit: 24 * time.Hour}
Defensive patterns

Strategy: validation

Validate before calling

ivl := conf.Limit.Truncate(time.Hour)
if ivl < time.Hour || ivl%time.Hour != 0 { return errors.New("limit must be whole hours within supported range") }

Try / catch

s, err := stats.New(conf)
if err != nil { if strings.Contains(err.Error(), "unsupported interval") { fixLimit() } }

Prevention

When it happens

Trigger: Calling stats.New with a Config whose Limit is outside the supported range or not a valid interval (e.g. 0, negative, or not a multiple of an hour), as validated by validateIvl.

Common situations: Misconfigured stats interval in YAML/JSON config (typo, wrong unit, 0), or upgrading to a version that restricts the allowed set of intervals.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/5b4c96ccdc6c8db6. Report an issue: GitHub.