adhoc resign invalidates the previous TCC grant
Debugging launchd-vs-terminal TCC differences for an adhoc-signed binary, and reaching for codesign --force to give it a stable identifier.
On macOS, TCC stores Full Disk Access (and other Privacy & Security grants) for adhoc-signed binaries by (path, cdhash), not just path. Running codesign --force --sign - --identifier <stable> <binary> to give the binary a more stable-looking identity changes the cdhash — even passing the same identifier produces a different signature blob each time, because codesign embeds timestamps and re-rolls some fields. The user's prior FDA grant immediately goes stale: the entry still appears in System Settings → Full Disk Access toggled on, but kernel TCC checks fail with the cryptic operation not permitted on protected paths. The fix is to remove the entry and re-add the now-different-cdhash binary, OR to skip resigning altogether and grant against the as-downloaded binary.
If you're tempted to codesign --force an adhoc-signed binary to fix a TCC issue, don't — first verify the TCC denial isn't actually a UI-state cache (toggle off-and-on in Settings) or a launch-context issue (terminal-vs-launchd). Resigning is almost never the right fix and immediately invalidates whatever consent the user already gave.