pkgutil --forget: Error "No such file or directory" I'm getting a path-location error.

$ pkgutil --forget com.apple.pkg.CLTools_Executables
Unknown error Error Domain=NSCocoaErrorDomain Code=4 "“com.apple.pkg.CLTools_Executables.bom” couldn’t be removed." UserInfo={NSFilePath=/var/db/receipts/com.apple.pkg.CLTools_Executables.bom, NSUserStringVariant=(
    Remove
), NSUnderlyingError=0x7fb0cdc0bd70 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}.
Forgot package 'com.apple.pkg.CLTools_Executables' on '/'.


The receipt data I want to discard is in /System/Library/Receipts/.

$ ls /System/Library/Receipts/com.apple.pkg.CLTool*
/System/Library/Receipts/com.apple.pkg.CLTools_Executables.bom
/System/Library/Receipts/com.apple.pkg.CLTools_Executables.plist
/System/Library/Receipts/com.apple.pkg.CLTools_SDK_OSX1012.bom
/System/Library/Receipts/com.apple.pkg.CLTools_SDK_OSX1012.plist
/System/Library/Receipts/com.apple.pkg.CLTools_SDK_macOS1013.bom
/System/Library/Receipts/com.apple.pkg.CLTools_SDK_macOS1013.plist
/System/Library/Receipts/com.apple.pkg.CLTools_SDK_macOSSDK.bom
/System/Library/Receipts/com.apple.pkg.CLTools_SDK_macOSSDK.plist


Why is pkgutil looking for the bill of materials (BOM) file in /var/db/receipts/?

Note: I've already deleted the folder /Library/Developer/CommandLineTools.

Motivation: Removing uninstalled Command Line Tools from AppStore updates
It's likely that the solution is the same for you as it was for me, which already is written in my post which you've linked to (Removing uninstalled Command Line Tools from AppStore updates).

Boot into recovery to disable SIP, then trash the files, then enable SIP again. Hopefully that works for you as well (seems to be exactly the same problem as I had).

EDIT: perhaps your actual question is why it's looking in the wrong path for the receipts. I have no idea, I'd like to know that myself. :)