Set_user gives User None not found

I keep getting User None not Found alert when i use frappe.set_user(“user@email”)

While this accomplishes my goal to set permissions for my doc.insert() transaction, I have to clear cookies to login again in this browser. Anyone have a more elegant solution?

This issue confirms my problem

https://github.com/frappe/erpnext/pull/23949

If we cannot use frappe.set_user() what’s the right way to set permissions for a guest user’s initiated action that inserts a record like Payment Entry for example?