How to fix APFS volume 'fsroot tree is invalid' on macOS High Sierra/Mojave?

When doing a first-aid check on my macOS APFS volume, I get the following message in the details:

"Checking the container superblock.", 0
"Checking the fusion superblock.", 0
"Checking the space manager.", 0
"Checking the object map.", 0
"Checking the snapshots.", 0
"Checking the APFS volume superblock.", 0
"Checking the fsroot tree.", 0
"Checking the extent ref tree.", 0
"Checking the snapshot metadata tree.", 0
"Verifying allocated space.", 0
"Checking the EFI jumpstart record.", 0
"Checking the Fusion data structures.", 0
"Checking the fragmented metadata trees.", 0
"Checking snapshot %ld of %ld.", 0
"Container superblock is invalid.", 0
"Fusion superblock is invalid.", 0
"Space manager is invalid.", 0
"Most recent checkpoint is invalid.", 0
"Object map is invalid.", 0
"Snapshot is invalid.", 0
"Volume superblock is invalid.", 0
"fsroot tree is invalid.", 0
"Extent ref tree is invalid.", 0
"Snapshot metadata tree is invalid.", 0
"Space Verification failed.", 0
"EFI jumpstart record is invalid.", 0
"Fusion data structures are invalid.", 0
"Encryption Rolling data structures are invalid.", 0
"Fragmented metadata trees are invalid.", 0

What's worse, when encountering "fsroot tree is invalid" on macOS High Sierra, we cannot access APFS volume and the important data stored it, how to fix APFS volume fsroot tree invalid on macOS High Sierra?

Solution 1: Recover data from corrupted APFS drive

APFS data recovery requires us to find a APFS data recovery software, there are a few software which can support APFS data recovery in market due to technical difficulty, M3 Mac Data Recovery is such a APFS data recovery software which can recover deleted/lost files from APFS hard drive and external hard drive in macOS 10.14/Mojave/10.13 High Sierra/10.12 Sierra and Mac OS X 10.11/10.10/10.9/10.8/10.7.

Tutorial to recover lost data from corrupted APFS drive

Step 1: Download and install this APFS Data Recovery software on your Mac computer.

Step 2: Run this APFS Data Recovery software - M3 Mac Data Recovery.

APFS data recovery software

Step 3: Select the corrupted APFS drive.

Step 4: This APFS Data Recovery software is scanning the lost data from corrupted APFS drive.

Step 5: Select the found data and then click Recover to save them.

Solution 2: Fix APFS volume fsroot tree invalid on macOS High Sierra by reformatting

After data recovery is successfully done, we can reformat this corrupted APFS volume to fix "fsroot tree is invalid" error in macOS High Sierra with the following solution:

Step 1: Launch Disk Utility from Utilities.

Step 2: Click the icon for your hard drive in the sidebar on the left.

Step 3: Click the Erase tab along the top of the window and enter the related information.

Step 4: Click the Erase button.

Step 4: Click the Erase button to fix "fsroot tree is invalid" error. After format completes, the corrupted APFS drive will be working again.

Related Mac data recovery solution: