{"record":{"id":"6b0a985e2b90ae9e","repo":"kopia/kopia","slug":"unsupported-hash-version-d","errorCode":null,"errorMessage":"unsupported hash version (%d)","messagePattern":"unsupported hash version \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/user/password_hashings.go","lineNumber":14,"sourceCode":"package user\n\nimport \"github.com/pkg/errors\"\n\n// getPasswordHashAlgorithm returns the password hash algorithm given a version.\nfunc getPasswordHashAlgorithm(passwordHashVersion int) (string, error) {\n\tswitch passwordHashVersion {\n\t// when the version is unsetDefaultHashVersion, map it to ScryptHashVersion\n\tcase unsetDefaultHashVersion, ScryptHashVersion:\n\t\treturn scryptHashAlgorithm, nil\n\tcase Pbkdf2HashVersion:\n\t\treturn pbkdf2HashAlgorithm, nil\n\tdefault:\n\t\treturn \"\", errors.Errorf(\"unsupported hash version (%d)\", passwordHashVersion)\n\t}\n}\n","sourceCodeStart":1,"sourceCodeEnd":17,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/internal/user/password_hashings.go#L1-L17","documentation":"getPasswordHashAlgorithm maps a PasswordHashVersion enum value to its hashing algorithm name. Any version outside the known set (unset/scrypt, pbkdf2) produces this error with the numeric version embedded in the message.","triggerScenarios":"Calling validate or computePasswordHash with a PasswordHashVersion value not defined in this build — typically hashes created by a newer kopia version, or a version field corrupted to a bogus integer.","commonSituations":"Opening a repository created by a newer kopia release with an older binary; manual edits to user profile metadata; migration scripts writing arbitrary version numbers.","solutions":["Upgrade kopia to a release that supports the stored hash version.","Re-set the affected user's password so a supported algorithm (scrypt or pbkdf2) generates the hash.","If the algorithm is actually known, map the version constant correctly instead of passing a raw integer.","Restore the user profile manifest from backup if the version field was corrupted."],"exampleFix":"// before\nh.PasswordHashVersion = 42\n// after\nh.PasswordHashVersion = user.Pbkdf2HashVersion // a supported constant","handlingStrategy":"try-catch","validationCode":"if !validHashVersion(h.PasswordHashVersion) { /* upgrade kopia or re-hash */ }","typeGuard":null,"tryCatchPattern":"_, err := user.GetUserProfile(ctx, rep, name)\nif err != nil && strings.Contains(err.Error(), \"unsupported hash version\") {\n    return fmt.Errorf(\"kopia too old for this repository: %w\", err)\n}","preventionTips":["Pin kopia version >= the version that created the repository.","Use named version constants, never raw integers, when constructing hashes.","On upgrade of hash defaults, migrate stored hashes explicitly."],"tags":["hash-version","unsupported","algorithm","compatibility"],"backgroundTag":"unsupported-enum-value","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"}