SigNoz/signoz · error

not a valid toCold TTL duration %v

Error message

not a valid toCold TTL duration %v

What it means

When a 'coldStorage' query parameter is present, a 'toColdDuration' must also be supplied and be a valid positive Go duration. This controls when data moves to cold storage, so an unparseable or non-positive value is rejected.

Source

Thrown at pkg/query-service/app/parser.go:452

	// Validate the type parameter
	if typeTTL != retentiontypes.TraceTTL && typeTTL != retentiontypes.MetricsTTL && typeTTL != retentiontypes.LogsTTL {
		return nil, fmt.Errorf("type param should be metrics|traces|logs, got %v", typeTTL)
	}

	// Validate the TTL duration.
	durationParsed, err := time.ParseDuration(delDuration)
	if err != nil || durationParsed.Seconds() <= 0 {
		return nil, fmt.Errorf("not a valid TTL duration %v", delDuration)
	}

	var toColdParsed time.Duration

	// If some cold storage is provided, validate the cold storage move TTL.
	if len(coldStorage) > 0 {
		toColdParsed, err = time.ParseDuration(toColdDuration)
		if err != nil || toColdParsed.Seconds() <= 0 {
			return nil, fmt.Errorf("not a valid toCold TTL duration %v", toColdDuration)
		}
		if toColdParsed.Seconds() != 0 && toColdParsed.Seconds() >= durationParsed.Seconds() {
			return nil, fmt.Errorf("delete TTL should be greater than cold storage move TTL")
		}
	}

	return &retentiontypes.TTLParams{
		Type:                  typeTTL,
		DelDuration:           int64(durationParsed.Seconds()),
		ColdStorageVolume:     coldStorage,
		ToColdStorageDuration: int64(toColdParsed.Seconds()),
	}, nil
}

func parseGetTTL(r *http.Request) (*retentiontypes.GetTTLParams, error) {

	typeTTL := r.URL.Query().Get("type")

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Supply toColdDuration in Go duration format, e.g. toColdDuration=24h
  2. Ensure it is strictly positive
  3. Only send coldStorage/toColdDuration when a cold storage backend is actually configured

Example fix

// before
?type=traces&duration=72h&coldStorage=s3
// after
?type=traces&duration=72h&coldStorage=s3&toColdDuration=24h
Defensive patterns

Strategy: validation

Validate before calling

if coldStorage != "" {
  d, err := time.ParseDuration(toColdDuration)
  if err != nil || d <= 0 { return fmt.Errorf("toColdDuration must be a positive Go duration") }
}

Prevention

When it happens

Trigger: Setting ?coldStorage=s3-bucket without toColdDuration, or with toColdDuration=0 / toColdDuration=abc / a bare number.

Common situations: Enabling cold storage tiering but forgetting the migration age; passing toColdDuration as milliseconds integer; partial copy-paste of the cold-storage API call.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/c7da1167236a6cd7. Report an issue: GitHub.