{"record":{"id":"befd82e4ba6fd802","repo":"kopia/kopia","slug":"invalid-epoch-parameters","errorCode":null,"errorMessage":"invalid epoch parameters","messagePattern":"invalid epoch parameters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/format/content_format.go","lineNumber":87,"sourceCode":"\tEpochParameters epoch.Parameters `json:\"epochParameters\"`        // epoch manager parameters\n}\n\n// Validate validates the parameters.\nfunc (v *MutableParameters) Validate() error {\n\tif v.MaxPackSize < minValidPackSize {\n\t\treturn errors.Errorf(\"max pack size too small, must be >= %v\", units.BytesString(minValidPackSize))\n\t}\n\n\tif v.MaxPackSize > maxValidPackSize {\n\t\treturn errors.Errorf(\"max pack size too big, must be <= %v\", units.BytesString(maxValidPackSize))\n\t}\n\n\tif v.IndexVersion < 0 || v.IndexVersion > index.Version2 {\n\t\treturn errors.New(\"invalid index version, supported versions are 1 & 2\")\n\t}\n\n\tif err := v.EpochParameters.Validate(); err != nil {\n\t\treturn errors.Wrap(err, \"invalid epoch parameters\")\n\t}\n\n\treturn nil\n}\n\n// GetEncryptionAlgorithm implements encryption.Parameters.\nfunc (f *ContentFormat) GetEncryptionAlgorithm() string {\n\treturn f.Encryption\n}\n\n// GetMasterKey implements encryption.Parameters.\nfunc (f *ContentFormat) GetMasterKey() []byte {\n\treturn f.MasterKey\n}\n\n// GetECCAlgorithm implements ecc.Parameters.\nfunc (f *ContentFormat) GetECCAlgorithm() string {\n\treturn f.ECC","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/repo/format/content_format.go#L69-L105","documentation":"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.","triggerScenarios":"Calling SetParameters with an EpochParameters struct that fails epoch-level validation (bad durations/counters, zero or negative epoch-related values).","commonSituations":"Enabling epoch-based index management with misconfigured epoch durations; passing partially-populated MutableParameters from JSON config; scripts that set epochs without validating first.","solutions":["Inspect the wrapped cause (errors.Wrap chain) to see the exact epoch parameter failure.","Fix the offending EpochParameters field (durations must be positive and within allowed ranges).","Call EpochParameters.Validate() before SetParameters to fail early.","Reset epoch parameters to defaults if unsure (`kopia repository set-parameters --epoch-...` defaults)."],"exampleFix":"// before\np.EpochParameters.EpochAdvanceTime = -1 * time.Hour\nrepo.SetParameters(ctx, p) // invalid epoch parameters\n// after\np.EpochParameters.EpochAdvanceTime = 7 * 24 * time.Hour\nif err := p.EpochParameters.Validate(); err == nil { repo.SetParameters(ctx, p) }","handlingStrategy":"validation","validationCode":"if err := p.EpochParameters.Validate(); err != nil {\n    return fmt.Errorf(\"epoch parameters invalid: %w\", err)\n}\n_ = repo.SetParameters(ctx, p)","typeGuard":null,"tryCatchPattern":"if err := repo.SetParameters(ctx, p); err != nil {\n    if strings.Contains(err.Error(), \"invalid epoch parameters\") {\n        // inspect cause for the exact field\n        return fmt.Errorf(\"bad epoch config: %w\", err)\n    }\n    return err\n}","preventionTips":["Validate EpochParameters separately before composing MutableParameters.","Only change epoch parameters one field at a time and test.","Use kopia CLI flags which enforce ranges rather than raw JSON."],"tags":["kopia","configuration","validation","epochs"],"backgroundTag":"schema-validation-failed","analyzedSha":"82495e54b584c1ef6073c9e1be048f57f8aef078","analyzedAt":"2026-09-07T20:35:21.689Z","contentChangedAt":"2026-09-07T20:35:21.689Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}