This exception is thrown from Authentication class and is often resolved by creating the rule off of Code-Security. This is the "privileged path". I'm not familiar with SwitchToOperAndRun but can take a look if this solution doesn't resolve your issue.
Thank you for posting your query in the PSC. This looks like an inactive post and hence, we suggest you create a new post for your query. Click on the Write a Post button that’s available on the top right pane of this page. Once created, please reply back here with the URL of the new post.
You may also refer this discussion link as a reference in the new thread.