Nishs-Mac:~ Nishit$ diskutil eraseVolume free free disk0s3
Started erase on disk0s3
Unmounting disk
Finished erase on disk0
Nishs-Mac:~ Nishit$ diskutil apfs resizeContainer disk1 0g
Started APFS operation
Aligning grow delta to 102,067,404,800 bytes and targeting a new physical store size of 500,068,036,608 bytes
Determined the maximum size for the targeted physical store of this APFS Container to be 500,067,006,464 bytes
Resizing APFS Container designated by APFS Container Reference disk1
The specific APFS Physical Store being resized is disk0s2
Verifying storage system
Using live mode
Performing fsck_apfs -n -x -l -S /dev/disk0s2
Checking the container superblock
Checking the EFI jumpstart record
Checking the space manager
Checking the space manager free queue trees
Checking the object map
Checking volume
Checking the APFS volume superblock
The volume Macintosh HD was formatted by hfs_convert (748.21.6) and last modified by apfs_kext (945.260.7)
Checking the object map
Checking the snapshot metadata tree
Checking the snapshot metadata
Checking the extent ref tree
Checking the fsroot tree
error: drec_val object (oid 0x323afa): invalid type (0)
fsroot tree is invalid
The volume /dev/disk0s2 could not be verified completely
Storage system check exit code is 0
Growing APFS Physical Store disk0s2 from 398,000,631,808 to 500,068,036,608 bytes
Modifying partition map
Growing APFS data structures
Finished APFS operation
Also If i am a root then how do i use the gdisk command in recovery. I thought I found a solution to the problem but it shows up Gdisk: Command not found.