{"record":{"id":"4022ea1b944d2b97","repo":"kopia/kopia","slug":"invalid-parameters","errorCode":null,"errorMessage":"invalid parameters","messagePattern":"invalid parameters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/format/format_manager.go","lineNumber":469,"sourceCode":"\t}\n\n\t// In legacy versions, the KeyDerivationAlgorithm may not be present in the\n\t// KopiaRepositoryJson. In those cases default to using Scrypt.\n\tif formatBlob.KeyDerivationAlgorithm == \"\" {\n\t\tformatBlob.KeyDerivationAlgorithm = DefaultKeyDerivationAlgorithm\n\t}\n\n\tif len(formatBlob.UniqueID) == 0 {\n\t\tformatBlob.UniqueID = randomBytes(UniqueIDLengthBytes)\n\t}\n\n\tformatEncryptionKey, err := formatBlob.DeriveFormatEncryptionKeyFromPassword(password)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to derive format encryption key\")\n\t}\n\n\tif err = repoConfig.Validate(); err != nil {\n\t\treturn errors.Wrap(err, \"invalid parameters\")\n\t}\n\n\tif err = blobcfg.Validate(); err != nil {\n\t\treturn errors.Wrap(err, \"blob config\")\n\t}\n\n\tif err = formatBlob.EncryptRepositoryConfig(repoConfig, formatEncryptionKey); err != nil {\n\t\treturn errors.Wrap(err, \"unable to encrypt format bytes\")\n\t}\n\n\tif err := formatBlob.WriteBlobCfgBlob(ctx, st, blobcfg, formatEncryptionKey); err != nil {\n\t\treturn errors.Wrap(err, \"unable to write blobcfg blob\")\n\t}\n\n\tif err := formatBlob.WriteKopiaRepositoryBlob(ctx, st, blobcfg); err != nil {\n\t\treturn errors.Wrap(err, \"unable to write format blob\")\n\t}\n","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/repo/format/format_manager.go#L451-L487","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nrepoConfig := format.RepositoryConfig{ContentFormat: format.ContentFormat{EncryptionAlgorithm: \"AES-GCM\"}}\n// after\nrepoConfig := format.DefaultContentFormat // use supported defaults, then override individual supported fields","handlingStrategy":"validation","validationCode":"// Validate the RepositoryConfig before passing it to Initialize\nif err := repoConfig.Validate(); err != nil {\n    return fmt.Errorf(\"refusing to initialize with invalid config: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if _, err := format.Initialize(ctx, st, opts, password); err != nil {\n    if strings.Contains(err.Error(), \"invalid parameters\") {\n        // rebuild with DefaultContentFormat and retry\n        opts.BlockFormat = format.DefaultContentFormat\n        return format.Initialize(ctx, st, opts, password)\n    }\n    return err\n}","preventionTips":["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"],"tags":["validation","configuration","initialization"],"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"}