kopia/kopia · critical

error decrypting BLOB

Error message

error decrypting BLOB %v

What it means

After deriving the IV, Decrypt calls Encryptor().Decrypt(payload, iv, output), which also verifies payload integrity (AEAD authentication). Failure is wrapped with 'error decrypting BLOB %v'. This almost always means the payload is corrupt, was truncated, or was encrypted with a different key.

Solutions

  1. Verify the repository key/passphrase is correct
  2. Re-read the blob from storage and check its integrity; re-download if the object store allows versioned reads
  3. Remove/rebuild the affected index blob if it is corrupt (kopia index rebuild / index recover)
  4. Check for storage backend issues (truncated uploads, failed syncs) and upgrade kopia if a format mismatch is suspected

Example fix

// before
if err := crypto.Decrypt(c, payload, blobID, output); err != nil { return err }
// after
if err := crypto.Decrypt(c, payload, blobID, output); err != nil {
    log.Errorf("index blob %v undecryptable; rebuilding index", blobID)
    return rebuildIndexBlob(ctx, blobID)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// verify blob integrity before decrypt if storage supports it
if err := st.GetBlob(ctx, blobID, 0, -1, buf); err != nil { return err }

Try / catch

if err := blobcrypto.Decrypt(c, payload, blobID, output); err != nil {
    log.Errorf("index blob %v failed integrity check: %v", blobID, err)
    return rebuildIndex(ctx, blobID)
}

Prevention

When it happens

Trigger: Calling Decrypt on a payload whose authentication tag fails verification — corrupted or tampered index blob data, wrong repository format/key, or truncated storage object.

Common situations: Storage backend returning corrupted or partially-written blobs; restoring blobs incorrectly; wrong passphrase/key supplied; bit rot on disk/object store.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of kopia/kopia@82495e54b5 (2026-09-07). Data as JSON: /api/errors/2c8dbf6cb3739173. Report an issue: GitHub.

Appendix: source

Thrown at internal/blobcrypto/blob_crypto.go:79

	if err := c.Encryptor().Encrypt(payload, iv, output); err != nil {
		return "", errors.Wrapf(err, "error encrypting BLOB %v", blobID)
	}

	return blobID, nil
}

// Decrypt decrypts the provided data using provided blobID to derive initialization vector.
func Decrypt(c Crypter, payload gather.Bytes, blobID blob.ID, output *gather.WriteBuffer) error {
	iv, err := getIndexBlobIV(blobID)
	if err != nil {
		return errors.Wrap(err, "unable to get index blob IV")
	}

	output.Reset()

	// Decrypt will verify the payload.
	if err := c.Encryptor().Decrypt(payload, iv, output); err != nil {
		return errors.Wrapf(err, "error decrypting BLOB %v", blobID)
	}

	return nil
}

View on GitHub (pinned to 82495e54b5)