This could be related to the session’s current user
If you run from a button click, then you are logged in as a user through the UI
If you run from a scheduled event, which user are you?
If there are autocommitted objects at the end of the ScheduledEvent, it will fail. You will be able to see this in the logmessages. With a user running the transaction the autocommitted object will stay available untill logout, that could be a reason for the difference in outcome.
Are you 100% sure that you configured the scheduled event correctly in your on premise environment? Maybe the accepted answer from this post helps: https://forum.mendix.com/link/questions/12082