{"record":{"id":"bb0597b03931b2e5","repo":"kopia/kopia","slug":"failed-to-load-index-entries-for-v0-index-entry","errorCode":null,"errorMessage":"failed to load index entries for v0 index entry","messagePattern":"failed to load index entries for v0 index entry","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command_repository_upgrade.go","lineNumber":148,"sourceCode":"\t\treturn errors.Wrapf(err, \"failed to list index blobs for old index\")\n\t}\n\n\tindexBlobInfos1, err := sm.IndexReaderV1().ListIndexBlobInfos(ctx)\n\tif err != nil {\n\t\tlog(ctx).Errorf(\"failed to list index blobs for new index. upgrade may have failed.: %v\", err)\n\t\treturn nil\n\t}\n\n\tif len(indexBlobInfos0) == 0 && len(indexBlobInfos1) > 0 {\n\t\tlog(ctx).Info(\"old index is empty (possibly due to upgrade), nothing to compare against\")\n\t\treturn nil\n\t}\n\n\t// load index blobs into their appropriate positions inside the indexEntries map\n\n\terr = loadIndexBlobs(ctx, indexEntries, sm, 0, indexBlobInfos0)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to load index entries for v0 index entry\")\n\t}\n\n\terr = loadIndexBlobs(ctx, indexEntries, sm, 1, indexBlobInfos1)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to load index entries for new index\")\n\t}\n\n\tvar msgs []string // a place to keep messages from the index comparison process\n\n\tvar zeroInfo content.Info\n\n\t// both indexes will have matching contentIDs with matching indexInfo structures.\n\t//nolint:gocritic\n\tfor contentID, indexEntryPairs := range indexEntries {\n\t\tiep0 := indexEntryPairs[0] // first entry of index entry pair\n\t\tiep1 := indexEntryPairs[1] // second entry of index entry pair\n\n\t\t// check that both the new and old indexes have entries for the same content","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/cli/command_repository_upgrade.go#L130-L166","documentation":"After listing blobs for both index generations, validateAction calls loadIndexBlobs for the v0 set (which=0). Any error returned by the per-blob loading is re-wrapped with this message, so this is the v0-side wrapper around failures like error 516 (failed to load index blob with BlobID X).","triggerScenarios":"Running `repository upgrade validate` when the v0 loadIndexBlobs pass fails — one or more old-generation index blobs cannot be loaded or decoded.","commonSituations":"Legacy repositories with corrupt v0 index blobs, interrupted historical index writes, object-store degradation, or upgrading a repository that was never fully consistent at the v0 layer.","solutions":["Note the inner BlobID error and inspect/repair that specific index blob.","Run index maintenance (`kopia index optimize`) or index rebuild before upgrading.","Restore from backup and retry the upgrade.","Proceed only after validate passes — never force an upgrade with a broken v0 index."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// pre-check the v0 index layer before upgrade validation\nif err := checkIndexLayerConsistency(ctx, rep, /* v0 */ 0); err != nil {\n    return fmt.Errorf(\"v0 index layer unhealthy; run index maintenance first: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := upgradeValidate(ctx, rep); err != nil && strings.Contains(err.Error(), \"failed to load index entries for v0 index entry\") {\n    log.Fatalf(\"legacy (v0) index is damaged — repair index or restore from backup before upgrading: %v\", err)\n}","preventionTips":["Never force an upgrade while the v0 index fails validation.","Schedule regular `kopia index optimize` to keep index layers healthy.","Upgrade only from clean backups taken immediately before the attempt.","Investigate the inner per-BlobID error before retrying."],"tags":["repository-upgrade","index","v0-index"],"backgroundTag":"file-read-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"}