Feature request: skip AppleDouble metadata files (`._*`) when scanning repository directories
Symptom (as reported by many users, e.g., searching for "invalid blob ID xn0" in Kopia issues):
failed to open repository: unable to create shared content manager:
error loading indexes: error downloading indexes:
error loading index blob xn0_35._424738db8bdb651eb46a4d9594756d-s0118b92321de227f142-c1:
decrypt blob: unable to get index blob IV:
invalid blob ID: xn0_35._424738db8bdb651eb46a4d9594756dThe blob ID Kopia is complaining about (xn0_35._424738db8bdb…) is
not a blob Kopia wrote. It's a companion metadata file created
automatically by macOS at the same path as a real blob:
xn0/_35/424738db8bdb651eb46a4d9594756d-s0118b92321de227f142-c1.f ← real Kopia blob
xn0/_35/._424738db8bdb651eb46a4d9594756d-s0118b92321de227f142-c1.f ← macOS AppleDouble companion (SAME base name, `._` prefix)Root cause:
Filesystems that don't natively support POSIX extended attributes
(most notably exFAT, but also FAT32, NTFS via ntfs-3g, and some SMB /
network mounts) are handled on macOS via the AppleDouble emulation
layer: when a Cocoa file API writes a file, the OS silently writes a
sibling file at the same path with a ._ prefix containing the
xattr bytes that couldn't be stored inline.
This is standard, documented macOS behavior — it applies to any file
touched by any Cocoa app, not just Kopia. When the Kopia repository
lives on such a filesystem, every blob Kopia writes gets a shadow
._blob-name companion in the same directory.
The failure mode is Kopia-specific: Kopia's blob storage backend enumerates
files in the shard directory (xn0/_35/) and attempts to parse every
entry name as a blob ID. When it encounters ._424738db8bdb…, its
parser rejects the ._ prefix and the entire repository open fails.
Reproduction (2 minutes on any Mac):
# Format any USB stick as exFAT (Disk Utility → Erase → exFAT)
kopia repository create filesystem --path=/Volumes/USB-EXFAT/repo
kopia snapshot create /some/small/dir
kopia repository disconnect
kopia repository connect filesystem --path=/Volumes/USB-EXFAT/repo
# → "invalid blob ID: xn0_…._…"Anecdotally the failure is reliable — the very first blob write causes
the very first AppleDouble companion, and every subsequent
repository connect fails until someone manually removes the ._*
files. Even one-off find … -delete cleanups don't stick: Kopia's own
background maintenance operations (index consistency check,
retention prune, GC) trigger fresh macOS writes on the volume, and
each write regenerates its AppleDouble companion.
Users on Reddit / GitHub issues who blame "non-Linux filesystems" for
this are half-right — it does specifically affect filesystems without
native xattrs — but the actual cause is that Kopia's blob directory
scanner accepts every filename it finds, whereas macOS's own conventions
would tell it to skip anything starting with ._.
Proposed fix (small, local, backwards-compatible):
In whichever code path enumerates blob-directory entries — likely
repo/blob/filesystem/filesystem_storage.go in the ListBlobs /
directory-walk routine — skip filenames matching the pattern:
._*— AppleDouble companion files (macOS convention on non-xattr filesystems)
Additionally worth skipping (harmless, and same class of "filesystem metadata that no legitimate Kopia blob ever looks like"):
.DS_Store— macOS Finder metadataThumbs.db— Windows Explorer thumbnails.Spotlight-V100/— macOS Spotlight index dir.Trashes/— macOS trash dir.fseventsd/— macOS FSEvents state$RECYCLE.BIN/— Windows recycle binSystem Volume Information/— Windows metadata
None of these can ever be a legitimate Kopia blob (blob IDs are generated cryptographic tokens with a specific base32/hex character set and no dot). Filtering them at the enumeration site is a one-line change with no risk of hiding real problems, and it removes the need for external cleanup tools (like KopiaGuard) that thousands of macOS users are quietly building to work around this.
Precedent:
The restic project handled the same class of issue by explicitly
ignoring certain filesystem metadata patterns in its scanner. borg
similarly skips hidden dotfiles at the top level of a repository. It's
a well-established pattern.
Why the workaround has to live on the user side today:
macOS TCC checks are per-process on the code-signature level. A shell
script (via bash + rm) that tries to clean up ._ files as a launchd
job is silently denied Full Disk Access to removable volumes on
Sequoia, because rm runs as its own process with its own Apple
signature (no FDA grant). The only way for a macOS user to clean
these files continuously today is to write a compiled binary,
bundle it as an .app, code-sign it, and grant it FDA — which is a
significant setup burden for a class of failure that Kopia itself
could avoid with a one-liner exclusion in its blob scanner.
Ballpark impact:
This would silently resolve the failure for every macOS user backing up to any exFAT-formatted removable drive (Seagate, WD, Samsung T7, etc. — nearly the entire external-drive market ships exFAT-formatted). It would also help Windows users who back up to network shares that lose xattrs. It's a small change with a large audience.
Thank you for maintaining Kopia — this is a genuinely excellent tool and this ask is meant to make one specific class of "why is it suddenly broken?" go away for a large chunk of your Mac userbase.
Source: kopia/kopia