kopia/kopia · error
invalid parameters
Error message
invalid parameters
What it means
Initialize validates the proposed RepositoryConfig (block-format parameters such as encryption, hashing, splitter) via repoConfig.Validate(). If any parameter is out of range or mutually inconsistent, Initialize aborts with 'invalid parameters', wrapping the underlying validation error. This happens before any blob is written, so the storage is left untouched.
Solutions
- Read the wrapped inner error from Validate() — it names the exact offending field
- Use format.DefaultContentFormat as a base and change only known-supported fields
- Verify algorithm names/versions against the constants exported by the format package
- Omit optional fields so library defaults are applied instead of zero values
Example fix
// before
repoConfig := format.RepositoryConfig{ContentFormat: format.ContentFormat{EncryptionAlgorithm: "AES-GCM"}}
// after
repoConfig := format.DefaultContentFormat // use supported defaults, then override individual supported fields Defensive patterns
Strategy: validation
Validate before calling
// Validate the RepositoryConfig before passing it to Initialize
if err := repoConfig.Validate(); err != nil {
return fmt.Errorf("refusing to initialize with invalid config: %w", err)
} Try / catch
if _, err := format.Initialize(ctx, st, opts, password); err != nil {
if strings.Contains(err.Error(), "invalid parameters") {
// rebuild with DefaultContentFormat and retry
opts.BlockFormat = format.DefaultContentFormat
return format.Initialize(ctx, st, opts, password)
}
return err
} Prevention
- Start from format.DefaultContentFormat and override only known-supported fields
- Always call Validate() on RepositoryConfig before submitting it
- Copy algorithm names from exported constants, not hand-typed strings
- Match format version to CurrentWriteVersion unless intentionally targeting older formats
When it happens
Trigger: Calling format.Initialize with a RepositoryConfig containing an unsupported encryption algorithm, unknown hash function, invalid format version, or contradictory options (e.g. format version below minimum or above current write version).
Common situations: Programmatic repository creation passing custom ContentFormat fields; typos in algorithm names like 'CHACHA20-POLY1305' or 'BLAKE2B-256-128'; copying parameters from documentation of a different Kopia version.
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
- blob config
- both retention mode and period must be provided when…
- bucket name must be specified
- epoch advance on count too low
- epoch advance on size too low
AI-assisted analysis of kopia/kopia@82495e54b5 (2026-09-07).
Data as JSON: /api/errors/4022ea1b944d2b97.
Report an issue: GitHub.
Appendix: source
Thrown at repo/format/format_manager.go:469
}
// In legacy versions, the KeyDerivationAlgorithm may not be present in the
// KopiaRepositoryJson. In those cases default to using Scrypt.
if formatBlob.KeyDerivationAlgorithm == "" {
formatBlob.KeyDerivationAlgorithm = DefaultKeyDerivationAlgorithm
}
if len(formatBlob.UniqueID) == 0 {
formatBlob.UniqueID = randomBytes(UniqueIDLengthBytes)
}
formatEncryptionKey, err := formatBlob.DeriveFormatEncryptionKeyFromPassword(password)
if err != nil {
return errors.Wrap(err, "unable to derive format encryption key")
}
if err = repoConfig.Validate(); err != nil {
return errors.Wrap(err, "invalid parameters")
}
if err = blobcfg.Validate(); err != nil {
return errors.Wrap(err, "blob config")
}
if err = formatBlob.EncryptRepositoryConfig(repoConfig, formatEncryptionKey); err != nil {
return errors.Wrap(err, "unable to encrypt format bytes")
}
if err := formatBlob.WriteBlobCfgBlob(ctx, st, blobcfg, formatEncryptionKey); err != nil {
return errors.Wrap(err, "unable to write blobcfg blob")
}
if err := formatBlob.WriteKopiaRepositoryBlob(ctx, st, blobcfg); err != nil {
return errors.Wrap(err, "unable to write format blob")
}
View on GitHub (pinned to 82495e54b5)