How to troubleshoot Rules when a required variable for an event is not provided? I'm seeing a strange behavior on my site and I'm trying to figure out how to correct it.

I have a rule that triggers on the event After updating an existing user account.  This rule uses two variables, account and account-unchanged.  Both of these should be provided by default.

However, for some reason user accounts are being saved upon login-- and when they are saved at login, account-unchanged is unset.  This leaves a PHP warning in watchdog.

To remove this error, I attempted to add a condition, Not data value is empty (account-unchanged, but this just gives me another watchdog warning like so:


  Unable to evaluate condition data_is_empty.


Ideally I will be able to find the reason why user accounts are being saved on login, but in the meantime, is there a way to prevent the rule from being evaluated when a required variable is not set?
Have a look at issue # 430274, about an event which is a variation of your event here, and somehow explains that "after saving something" actually happens "before saving something". This is not a bug, but simply how the Rules module works.

A possible compromise to avoid these kind of issues, is to transform what's you're trying to do into a Rules component, so that your original Rule "schedules the execution" (using the Rules Scheduler sub-module) of that Rules component. For example after only a few seconds or minutes if your cron job runs frequent enough (otherwise it'll be next time cron runs). This compromise will ensure that, at the time the Rules component is executed, the entity is for sure saved (so that can't be the reason anymore then why things don't work as expected).

Note: maybe it's worth to do some Rules debugging, as detailed in "How can I display the value of a variable inside a condition?"