{"record":{"id":"f666e0b663edb4d0","repo":"kopia/kopia","slug":"unable-to-open-index-blob-q","errorCode":null,"errorMessage":"unable to open index blob %q","messagePattern":"unable to open index blob %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/content/indexblob/index_blob_manager_v0.go","lineNumber":587,"sourceCode":"\t\t\t}\n\t\t}\n\n\t\tcontentlog.Log1(ctx, m.log, \"finished drop-content-deleted-before\", logparam.Time(\"dropDeletedBefore\", opt.DropDeletedBefore))\n\t}\n}\n\nfunc addIndexBlobsToBuilder(ctx context.Context, enc *EncryptionManager, addEntry func(index.Info), indexBlobID blob.ID) error {\n\tvar data gather.WriteBuffer\n\tdefer data.Close()\n\n\terr := enc.GetEncryptedBlob(ctx, indexBlobID, &data)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error getting index %q\", indexBlobID)\n\t}\n\n\tndx, err := index.Open(data.ToByteSlice(), nil, enc.crypter.Encryptor().Overhead)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to open index blob %q\", indexBlobID)\n\t}\n\n\t_ = ndx.Iterate(index.AllIDs, func(i index.Info) error {\n\t\taddEntry(i)\n\t\treturn nil\n\t})\n\n\treturn nil\n}\n\nfunc blobsOlderThan(m []blob.Metadata, cutoffTime time.Time) []blob.Metadata {\n\tvar res []blob.Metadata\n\n\tfor _, m := range m {\n\t\tif !m.Timestamp.After(cutoffTime) {\n\t\t\tres = append(res, m)\n\t\t}\n\t}","sourceCodeStart":569,"sourceCodeEnd":605,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/repo/content/indexblob/index_blob_manager_v0.go#L569-L605","documentation":"After successfully downloading an index blob, addIndexBlobsToBuilder calls index.Open to parse its contents; this error wraps a parse/decode failure. It means the blob exists and was fetched/decrypted, but its bytes are not a valid index blob for the current format (accounting for the encryptor overhead).","triggerScenarios":"Compacting when an index blob is corrupt or truncated on disk/storage, was written by an incompatible (newer) index format version, or the encryptor overhead doesn't match how the blob was written.","commonSituations":"Bit-rot or interrupted upload leaving a truncated blob; opening a repository created by a newer Kopia with an older client; mixing index format versions after a failed upgrade to index blob manager V1.","solutions":["Upgrade the Kopia client to match (or exceed) the version that wrote the repository.","Delete or quarantine the corrupt index blob and re-run compaction so a fresh one is generated from remaining blobs.","Verify storage integrity (checksums) and restore the blob from a backup or replica.","Check that the repository's format-blob encryption overhead matches the key being used."],"exampleFix":"// before\nndx, err := index.Open(data.ToByteSlice(), nil, enc.crypter.Encryptor().Overhead)\nif err != nil {\n    return errors.Wrapf(err, \"unable to open index blob %q\", indexBlobID)\n}\n// after: skip corrupt blobs instead of failing the whole epoch\nndx, err := index.Open(data.ToByteSlice(), nil, enc.crypter.Encryptor().Overhead)\nif err != nil {\n    return errors.Wrapf(err, \"unable to open index blob %q; consider removing this corrupt blob\", indexBlobID)\n}","handlingStrategy":"validation","validationCode":"hdr, err := st.GetMetadata(ctx, indexBlobID)\nif err == nil && hdr.Length < minValidIndexBlobSize {\n    return fmt.Errorf(\"index blob %q suspiciously small (%d bytes); likely corrupt\", indexBlobID, hdr.Length)\n}","typeGuard":"func validIndexBlob(data []byte) bool {\n    _, err := index.Open(data, nil, overhead)\n    return err == nil\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unable to open index blob\") {\n    // corrupt or incompatible blob: quarantine it, upgrade client if version mismatch\n    quarantineBlob(indexBlobID)\n}","preventionTips":["Use matching Kopia versions across all clients touching a repository.","Enable storage-side checksumming/integrity features to detect bit-rot.","Keep repository backups so corrupt index blobs can be restored.","Never interrupt uploads (e.g. kill -9) that write index blobs."],"tags":["corruption","index","parsing"],"backgroundTag":"protobuf-unmarshal-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"}