Two years later... encountered this problem again, but this time it was a different cause/solution.
I was creating a new (and quite complicated) dialog, and had just started building the Dialog Callback Procedure. I only had a couple of lines in the procedure, setting a couple of variables, just to watch the script go in there, but I had forgotten to return anything! What I observed was that the script would start... and stop immediately. Adding a DebugTrace() command, I saw the script enter the callback procedure, and then end with the same error: TERMINAL WIL ERROR=>9999 (User requested Cancel)
The solution was to return a valid value, in my case -2 (to allow the dialog to remain on screen).
To make my code more readable, I follow Tony's recommended of setting usefully-named variable constants, so my actual return statement was: return c_DO_NOT_EXIT. Again, I got same error TERMINAL WIL ERROR=>9999 (User requested Cancel). I had forgotten to actually create that variable, so I was trying to return a non-existent variable. As soon as I create the variable at the top of the script, everything worked perfectly.
So, those are two more things to check if you encounter this error.