hashicorp/nomad · error

telemetry in-memory collection interval cannot be greater th

Error message

telemetry in-memory collection interval cannot be greater than retention period

What it means

After both durations individually pass, telemetry validation enforces collection_interval <= retention_period. Collecting more frequently than data is retained would evict samples before a full cycle, so the combination is rejected as conflicting in-memory settings.

Source

Thrown at command/agent/config.go:1533

// Validate the telemetry configuration options. These are used by the agent,
// regardless of mode, so can live here rather than a structs package. It is
// safe to call, without checking whether the config object is nil first.
func (t *Telemetry) Validate() error {
	if t == nil {
		return nil
	}

	// Ensure we have durations that are greater than zero.
	if t.inMemoryCollectionInterval <= 0 {
		return errors.New("telemetry in-memory collection interval must be greater than zero")
	}
	if t.inMemoryRetentionPeriod <= 0 {
		return errors.New("telemetry in-memory retention period must be greater than zero")
	}

	// Ensure the in-memory durations do not conflict.
	if t.inMemoryCollectionInterval > t.inMemoryRetentionPeriod {
		return errors.New("telemetry in-memory collection interval cannot be greater than retention period")
	}

	return nil
}

// Eventlog is the configuration for the Windows Eventlog
type Eventlog struct {
	// Enabled controls if Nomad agent logs are sent to the
	// Windows eventlog.
	Enabled bool `hcl:"enabled"`
	// Level of logs to send to eventlog. May be set to higher
	// severity than LogLevel but lower level will be ignored.
	Level string `hcl:"level"`
}

// Copy is used to copy the Eventlog configuration
func (e *Eventlog) Copy() *Eventlog {
	return &Eventlog{

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Increase the retention period so it is >= the collection interval.
  2. Or decrease the collection interval so it fits within the retention window.
  3. Add a CI/config lint asserting interval <= retention for telemetry settings.

Example fix

// before
telemetry {
  in_memory_collection_interval = "2h"
  in_memory_retention_period    = "1h"
}

// after
telemetry {
  in_memory_collection_interval = "10s"
  in_memory_retention_period    = "1h"
}
Defensive patterns

Strategy: validation

Validate before calling

if t := cfg.Telemetry; t != nil && t.InMemoryCollectionInterval > t.InMemoryRetentionPeriod {
    return errors.New("telemetry collection interval must be <= retention period")
}

Type guard

func telemetryDurationsValid(t *Telemetry) bool {
    return t != nil && t.InMemoryCollectionInterval > 0 &&
        t.InMemoryRetentionPeriod > 0 &&
        t.InMemoryCollectionInterval <= t.InMemoryRetentionPeriod
}

Prevention

When it happens

Trigger: Telemetry config where inMemoryCollectionInterval is strictly greater than inMemoryRetentionPeriod (both positive), e.g. collect every 2h but retain only 1h.

Common situations: Tuning collection frequency upward without adjusting retention; defaults overridden independently by ops tooling; misunderstanding that retention must be the larger window.

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


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/4a40f53449c82fc5. Report an issue: GitHub.