I would start by looking at your situation when the script step is being run.
509 = "Field requires a valid value"
There was a field defined on the layout I was navigating away from, that was empty, and had the Required Value attribute set.
I'm sure it was working fine yesterday, but I'm not 100% sure!
Thanks again for the input.
I had a similar situation, but the field with the error was not on the layout.
There was only one field with validation in the table, and it wasn't on the layout.
Removing the validation stopped the error.
So it may be that FMP now validates records whenever a layout is unloaded.
Yes, switching to a different layout commits the current record which performs any validation checks on all fields.