Auto-play script on connect failing with 500 error during Zendesk macro migration

What is the reason this setting causes the script to fail immediately upon agent login during our Zendesk migration?

We are currently rebuilding our agent workflows to replicate the logic of Zendesk Macros in Genesys Cloud Architect. The goal is to automatically populate a specific custom data field based on the inbound ticket priority, similar to how Zendesk handled ticket tags. However, when we enable the ‘Auto-play script on connect’ setting in the IVR configuration, the flow crashes with a 500 Internal Server Error. The Architect debug log points to a Data Action failure when trying to write to the custom attribute. This is confusing because the Data Action works perfectly in standalone testing. We are using the latest Genesys Cloud platform version. The issue seems specific to the timing of the script execution relative to the interaction creation event. In Zendesk, macros ran after the ticket was fully established. Here, it seems the interaction object is not fully initialized when the script triggers. We need to know if there is a delay mechanism or a specific trigger condition we should use instead of the auto-play feature to ensure the custom data field is ready for writing.