{"record":{"id":"9872a5ac897e92c5","repo":"kopia/kopia","slug":"error-getting-repository-features","errorCode":null,"errorMessage":"error getting repository features","messagePattern":"error getting repository features","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command_repository_upgrade.go","lineNumber":447,"sourceCode":"\t\t\treturn errors.New(\"upgrade drain interrupted\")\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// upgrade phase performs the actual upgrade action that upgrades the target\n// repository. This phase runs after the lock has been acquired in one of the\n// prior phases.\nfunc (c *commandRepositoryUpgrade) upgrade(ctx context.Context, rep repo.DirectRepositoryWriter) error {\n\tmp, mperr := rep.ContentReader().ContentFormat().GetMutableParameters(ctx)\n\tif mperr != nil {\n\t\treturn errors.Wrap(mperr, \"mutable parameters\")\n\t}\n\n\trf, err := rep.FormatManager().RequiredFeatures(ctx)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error getting repository features\")\n\t}\n\n\tif mp.EpochParameters.Enabled {\n\t\t// nothing to upgrade on format, so let the next action commit the upgraded format blob\n\t\treturn nil\n\t}\n\n\tmp.EpochParameters = epoch.DefaultParameters()\n\tmp.IndexVersion = 2\n\n\tlog(ctx).Info(\"migrating current indices to epoch format\")\n\n\tif uerr := rep.ContentManager().PrepareUpgradeToIndexBlobManagerV1(ctx); uerr != nil {\n\t\treturn errors.Wrap(uerr, \"error upgrading indices\")\n\t}\n\n\tblobCfg, err := rep.FormatManager().BlobCfgBlob(ctx)\n\tif err != nil {","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/cli/command_repository_upgrade.go#L429-L465","documentation":"During `kopia repository upgrade`, the upgrade command asks the repository's FormatManager for the set of required format features via RequiredFeatures(ctx). If that call fails, kopia wraps the underlying error with \"error getting repository features\" and aborts the upgrade before any parameters are modified. This error means kopia could not read or interpret the repository format metadata, so it cannot determine which format features the repository requires.","triggerScenarios":"FormatManager().RequiredFeatures(ctx) returns an error — typically because the format-blob (kopia.repository) cannot be read/decrypted/decoded from blob storage, or the underlying blob storage API call fails.","commonSituations":"Corrupted or manually edited kopia.repository format blob; wrong repository password so format-blob decryption fails; blob storage backend unreachable or credentials expired mid-upgrade; upgrading a repository whose format blob was written by an incompatible kopia version.","solutions":["Run `kopia repository status` to confirm the repository and format blob are readable before upgrading","Re-check the repository password / cached credentials and reconnect with `kopia repository connect`","Verify blob storage connectivity and credentials (bucket exists, permissions correct)","If the format blob is corrupted, restore it from the format-blob backup or contact support; do not hand-edit it","Retry the upgrade with a kopia version matching (or newer than) the one that created the repository"],"exampleFix":"// before: upgrading against a stale/broken connection\nrep, _ := openRepo(ctx)\nrf, err := rep.FormatManager().RequiredFeatures(ctx) // fails: blob unreachable\n// after: validate repository access first\nif err := rep.FormatManager().VerifyMasterPassword(ctx); err != nil {\n    log(ctx).Errorf(\"repository unlock failed: %v\", err)\n    return err\n}\nrf, err := rep.FormatManager().RequiredFeatures(ctx)","handlingStrategy":"validation","validationCode":"// before upgrade, verify the repository format is readable\nif _, err := rep.FormatManager().RequiredFeatures(ctx); err != nil {\n    return fmt.Errorf(\"repository format unreadable, fix access/password first: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"// treat wrapped cause explicitly\nvar perr *blobStorageError\nif errors.As(err, &perr) { /* fix storage access */ }\nif passwordErr := rep.FormatManager().VerifyMasterPassword(ctx); passwordErr != nil { /* re-authenticate */ }","preventionTips":["Run `kopia repository status` before any `repository upgrade`","Keep the kopia client version >= the repository format version","Protect the format blob from manual edits; keep format-blob backups","Validate storage credentials/connectivity before long upgrade operations"],"tags":["cli","repository","upgrade","storage"],"backgroundTag":"resource-not-found","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"}