We are getting this error when generating a PDF from a document template. Maybe it helps in the investigation.
I was also getting this error first time on Mendix v9.24.23 when user exporting PDF from Mendix application button click.
Root cause: it was analyzed that business is using email or html txt copy and directly pasting into Rich text widget on Mendix page. In this text, hyperlink and special characters are also coming and these are causing error when user wants to export PDF. PDF template is being used for this feature development.
com.mendix.webui.WebUIException: Exception while executing runtime operation at com.mendix.webui.actions.client.RuntimeOperationAction.$anonfun$apply$1(RuntimeOperationAction.scala:62)Caused by: com.mendix.webui.WebUIException: Attempt to illegally add an object to the state with id '58546795156176885' at com.mendix.webui.requesthandling.helpers.StateHandling.$anonfun$addObjectsToState$1(StateHandling.scala:133)
Solution: we educated business to paste same text in note file to make it a plain text, then copy and paste it from text file into Mendix so that unwanted styles and characters will not come into application and PDF will be exported smoothly. This is helping us as of now.