Add the script step
Set Error Capture[on]
anywhere in the script before the scripted find.
Is there any real difference between Get (FoundCount) = 0 and Get (LastError) = 401 in this case?
I would have thought not. Error 401 means "No records match the request", which is the same as a found count of zero.