kopia/kopia · error

invalid epoch parameters

Error message

invalid epoch parameters

What it means

MutableParameters.Validate wraps any error from EpochParameters.Validate with the message "invalid epoch parameters". Epoch manager parameters have their own constraints; if they fail, SetParameters rejects the whole parameter set with this wrapped error.

Solutions

  1. Inspect the wrapped cause (errors.Wrap chain) to see the exact epoch parameter failure.
  2. Fix the offending EpochParameters field (durations must be positive and within allowed ranges).
  3. Call EpochParameters.Validate() before SetParameters to fail early.
  4. Reset epoch parameters to defaults if unsure (`kopia repository set-parameters --epoch-...` defaults).

Example fix

// before
p.EpochParameters.EpochAdvanceTime = -1 * time.Hour
repo.SetParameters(ctx, p) // invalid epoch parameters
// after
p.EpochParameters.EpochAdvanceTime = 7 * 24 * time.Hour
if err := p.EpochParameters.Validate(); err == nil { repo.SetParameters(ctx, p) }
Defensive patterns

Strategy: validation

Validate before calling

if err := p.EpochParameters.Validate(); err != nil {
    return fmt.Errorf("epoch parameters invalid: %w", err)
}
_ = repo.SetParameters(ctx, p)

Try / catch

if err := repo.SetParameters(ctx, p); err != nil {
    if strings.Contains(err.Error(), "invalid epoch parameters") {
        // inspect cause for the exact field
        return fmt.Errorf("bad epoch config: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling SetParameters with an EpochParameters struct that fails epoch-level validation (bad durations/counters, zero or negative epoch-related values).

Common situations: Enabling epoch-based index management with misconfigured epoch durations; passing partially-populated MutableParameters from JSON config; scripts that set epochs without validating first.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of kopia/kopia@82495e54b5 (2026-09-07). Data as JSON: /api/errors/befd82e4ba6fd802. Report an issue: GitHub.

Appendix: source

Thrown at repo/format/content_format.go:87

	EpochParameters epoch.Parameters `json:"epochParameters"`        // epoch manager parameters
}

// Validate validates the parameters.
func (v *MutableParameters) Validate() error {
	if v.MaxPackSize < minValidPackSize {
		return errors.Errorf("max pack size too small, must be >= %v", units.BytesString(minValidPackSize))
	}

	if v.MaxPackSize > maxValidPackSize {
		return errors.Errorf("max pack size too big, must be <= %v", units.BytesString(maxValidPackSize))
	}

	if v.IndexVersion < 0 || v.IndexVersion > index.Version2 {
		return errors.New("invalid index version, supported versions are 1 & 2")
	}

	if err := v.EpochParameters.Validate(); err != nil {
		return errors.Wrap(err, "invalid epoch parameters")
	}

	return nil
}

// GetEncryptionAlgorithm implements encryption.Parameters.
func (f *ContentFormat) GetEncryptionAlgorithm() string {
	return f.Encryption
}

// GetMasterKey implements encryption.Parameters.
func (f *ContentFormat) GetMasterKey() []byte {
	return f.MasterKey
}

// GetECCAlgorithm implements ecc.Parameters.
func (f *ContentFormat) GetECCAlgorithm() string {
	return f.ECC

View on GitHub (pinned to 82495e54b5)