{"record":{"id":"561d2b5c0f512b86","repo":"kopia/kopia","slug":"max-pack-size-too-small-must-be-v","errorCode":null,"errorMessage":"max pack size too small, must be >= %v","messagePattern":"max pack size too small, must be >= (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/format/content_format.go","lineNumber":75,"sourceCode":"\n// SupportsPasswordChange implements FormattingOptionsProvider.\nfunc (f *ContentFormat) SupportsPasswordChange() bool {\n\treturn f.EnablePasswordChange\n}\n\n// MutableParameters represents parameters of the content manager that can be mutated after the repository\n// is created.\ntype MutableParameters struct {\n\tVersion         Version          `json:\"version,omitempty\"`      // version number, must be \"1\", \"2\" or \"3\"\n\tMaxPackSize     int              `json:\"maxPackSize,omitempty\"`  // maximum size of a pack object\n\tIndexVersion    int              `json:\"indexVersion,omitempty\"` // force particular index format version (1,2,..)\n\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.","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/repo/format/content_format.go#L57-L93","documentation":"MutableParameters.Validate enforces that MaxPackSize is at least minValidPackSize. A pack size below the minimum would break pack block internals (checksums, index offsets), so kopia refuses to accept such configuration. It is thrown when SetParameters is called with too-small MaxPackSize.","triggerScenarios":"Calling SetParameters (or `kopia repository set-parameters --max-pack-size`) with a MaxPackSize smaller than the minimum valid pack size constant.","commonSituations":"Typo in CLI flag value (e.g. `--max-pack-size=1KB`); scripting parameter changes with wrong units; attempting to shrink pack size aggressively to save space.","solutions":["Set MaxPackSize to a value >= minValidPackSize (use unit strings like 20MB).","Check the CLI flag value and units (`kopia repository set-parameters --max-pack-size=20MB`).","Query current parameters first (`kopia repository status`) and adjust incrementally.","Clamp the value in automation before calling SetParameters."],"exampleFix":"// before\np.MaxPackSize = 1 * units.KiB\nrepo.SetParameters(ctx, p) // error: too small\n// after\np.MaxPackSize = 20 * units.MiB\nrepo.SetParameters(ctx, p)","handlingStrategy":"validation","validationCode":"if p.MaxPackSize < formatMinValidPackSize {\n    return fmt.Errorf(\"MaxPackSize %v below minimum %v\", p.MaxPackSize, formatMinValidPackSize)\n}","typeGuard":null,"tryCatchPattern":"if err := repo.SetParameters(ctx, p); err != nil {\n    var verr interface{ Validation() bool }\n    // treat as user input error, not retryable\n    return fmt.Errorf(\"invalid parameters: %w\", err)\n}","preventionTips":["Always run MutableParameters.Validate() before SetParameters.","Use unit strings (20MB) in CLI flags to avoid unit mistakes.","Read `kopia repository status` for current valid ranges."],"tags":["kopia","configuration","validation"],"backgroundTag":"value-out-of-range","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"}