First Aid: refcnt of dstream id object is less than expected
First Aid fails with "refcnt of dstream id object is less than expected"? Back up, repair from Recovery with First Aid and fsck_apfs, then reinstall if needed.
TroubleshootingUpdated 7 min read
On this page
First Aid ends with a failure and the log reads like this:
error: refcnt (1) of dstream id object (id 22243481) is less than expected (2)
error: alloced_size (49152) of dstream (id 22243481) does not match calculated size (0)
The volume /dev/rdisk3s5 with UUID BC1F25BB-ED9C-42FF-B135-75AF337F9195 was found to be corrupt and needs to be repaired.
File system verify or repair failed. : (-69845)Your ID numbers and UUID will differ. What matters is the pattern: a reference count that doesn't match, an allocated size that doesn't match, a corrupt volume and a failed repair. In the report this page is based on (an M1 MacBook Pro), First Aid also ended with exit code 8, and Finder and DaisyDisk disagreed about free space. That second symptom is covered at the end.
Why it happens
The message says one record in the file system's metadata (a "dstream" holds a file's size and extents) is referenced fewer times than the checker expects, and its stored size doesn't match what the checker calculates. In plain terms, the file system's own bookkeeping is inconsistent.
- Most common: file-system metadata damage. Typical triggers are an interrupted write, a crash, a forced shutdown, or a failed update. We can't tell from the report what caused this one.
- Less common: failing hardware. A passing SMART check doesn't rule this out, but it doesn't suggest it either. In the report,
smartctlpassed and the volume was still corrupt. SMART looks at the drive, while this error is about the structures stored on it. - Not a cause: your files or apps. Nothing you installed "caused" a refcnt mismatch. The fix is at the file-system level.
Step 1: Back up before you repair
A repair on a corrupt volume can fail or lose files, and you can't undo it. Apple's own guidance is to have a current backup before running First Aid, in case it finds errors it can't repair (Apple Support: How to repair a Mac storage device with Disk Utility).
- Connect an external drive.
- Run a Time Machine backup (open System Settings and search for "Time Machine").
- Also copy irreplaceable folders (Documents, Desktop, your Photos library, project folders) to the drive by hand. If Time Machine can't finish on a damaged volume, this may be your only copy.
- Open a few copied files to confirm they work.
Step 2: Run First Aid from Recovery
Apple says to run First Aid on each volume and container in turn, then on the storage device itself. To check and repair a disk, you need to run First Aid on each volume and container on the storage device in turn, then run it on the storage device itself.
- Choose Apple menu > Shut Down and wait until the screen is fully dark.
- Press and hold the power button until the Options button appears, then click Options and Continue.
- In the Recovery app, select Disk Utility, then click Continue.
- Choose View > Show All Devices.
- Select the last volume (usually Macintosh HD - Data), click First Aid, then Run.
- Repeat for Macintosh HD, then for the container, then for the physical disk at the top.
If you check your startup volume (Macintosh HD), make sure you also check your data volume (Macintosh HD - Data). If every step finishes cleanly, restart and run First Aid once more from macOS to confirm.
Step 3: Check and repair the container with fsck_apfs
First Aid runs Apple's APFS checker. Running fsck_apfs yourself in Terminal can show more detail. This is a more advanced step, so do it only after your backup is complete.
In Recovery, choose Utilities > Terminal.
List your disks:
bash diskutil listFind the APFS container that holds your volumes. In the error above the damaged volume was
disk3s5, so the container would bedisk3. Use the identifiers from your own output, because they can differ in Recovery.Run a read-only check. The
-nflag changes nothing:bash fsck_apfs -n /dev/disk3If it reports the same problems, run the repair. This modifies the file system and can't be undone.
bash fsck_apfs -y /dev/disk3The
-yflag answers yes to every repair prompt. Replacedisk3with your container identifier.Run
fsck_apfs -n /dev/disk3again. A clean pass means the repair worked. Restart and run First Aid again to confirm.
Step 4: Erase and reinstall macOS
If First Aid fails again, Apple's advice is to retry once, then rebuild. If that doesn't work, back up as much of your data as possible, reformat the disk, reinstall macOS, then restore your backed-up data.
- Confirm the backup is complete and that you can open files from it.
- Optional first try: in Recovery, choose Reinstall macOS. Reinstalling macOS doesn't remove your apps or personal data, but a corrupt volume can make the install fail.
- If the reinstall fails or the errors return, go back to Disk Utility, select the volume, and click Erase. On Apple silicon, choose APFS as the format, then click Erase Volume Group. Apple's page for Apple silicon Macs also says that if you see an Erase Volume Group button, click that instead of Erase (Use Disk Utility to erase a Mac with Apple silicon).
- When the erase finishes, quit Disk Utility, choose Reinstall macOS and follow the prompts.
- Restore from Time Machine, or use Migration Assistant from macOS.
Erasing deletes your accounts and files, so only do it with a verified backup. Apple's pages: Use macOS Recovery on a Mac with Apple silicon and How to repair a Mac storage device with Disk Utility.
Quick reference
| What you see | Likely meaning | Do this |
|---|---|---|
| First Aid passes on volumes, fails on the container | Container-level metadata problem | Step 3 (fsck_apfs) |
Same refcnt error after fsck_apfs -y | Damage the checker can't repair | Step 4 (erase, reinstall) |
| Errors return after a clean install | Possible hardware fault | Apple Diagnostics, then Apple Support |
| Erase fails or the disk doesn't appear | Mac may need service | Apple Support |
Why Finder and DaisyDisk showed different free space
In the report, Finder showed 217 GB free, DaisyDisk showed 98.7 GB free, and the folders added up to 423.7 GB. Some gap between those tools is normal:
- Finder's "available" space includes purgeable space. macOS frees purgeable space on demand (local snapshots, optimized iCloud files, evictable caches). A tool that reports truly free space shows less. See what purgeable space is on a Mac.
- Local Time Machine snapshots take space. List them read-only with
tmutil listlocalsnapshots /. - Unreadable folders leave totals short. A scanner without Full Disk Access skips protected folders such as Mail and Messages.
- System files and other volumes on the same disk count as used but don't show up in a scan of your folders.
We can't say whether the corruption caused that particular gap. Inconsistent size records, like the alloced_size mismatch above, could plausibly make a file system misreport space, but that is an inference. Repair the volume first, then compare the numbers again. If the gap remains, work through the causes above, and see how to check storage on a Mac.
Checklist before you try again
- Time Machine backup finished, plus a manual copy of irreplaceable files.
- You opened a few backed-up files successfully.
- The Mac is plugged in and you have internet (reinstalling needs it).
- You ran First Aid in order: volumes, container, disk.
- You used the identifiers from your own
diskutil listoutput.
If nothing works
If the erase fails, the disk doesn't show up, or the error returns on a fresh install, contact Apple Support or an Apple Authorized Service Provider. If Disk Utility reports that the erase process failed, your Mac might need service. You can also run Apple Diagnostics first: shut down, hold the power button until startup options appear, then press ⌘D (Command-D).
Subject: APFS corruption, First Aid fails with refcnt error
Mac model and macOS version: <your model, your macOS version>
First Aid fails on the volume/container with:
error: refcnt (1) of dstream id object (id 22243481) is less than expected (2)
error: alloced_size (49152) of dstream (id 22243481) does not match calculated size (0)
File system verify or repair failed. : (-69845), exit code 8
Already tried: Time Machine backup, First Aid in Recovery (volumes, container, disk),
fsck_apfs -n and -y on the container, erase and reinstall macOS.
SMART status: passed. Apple Diagnostics result: <result>Common questions
Does a passing SMART check mean my disk is fine?
No. SMART reports on the drive hardware. This error is about the file-system structures on it, so both can be true at once.
Will First Aid or fsck_apfs delete my files?
They try to repair metadata, not remove your data, but a repair on a corrupt volume can lose files. That's why the backup comes first.
Can I just ignore the error?
It's risky. The volume is reported as corrupt, and damage can spread or cause crashes and failed updates. Back up now, and repair when you can.
Will Gigabroom fix this?
No. It doesn't repair file systems. Its System Data screen shows free, purgeable and used space read-only, which can help explain a free-space gap once the volume is healthy (see Understanding System Data).