Transaction and Exception Error caused by codes?

Hi, buddies.
I am in a trouble by Transaction things.
The trouble is a crash when executing a certain dynamo file.

Then, I tried to figure the reason out from Revit 2024 journal and found lines like:

'inTransaction APITransactionIdentity_1:-1 Dynamo-51297CB5 Script
'requestingFinish of transaction APITransactionIdentity_1 (start):-1 Dynamo-51297CB5 Script
'C 22-May-2024 16:06:07.170; DBG_INFO: Exception thrown from requestFinishTransaction. Acquiring the proxy back and re-throwing the exception to the upper caller.: line 1122 of E:\Ship24.1.1\2024_px64\Source\Revit\RevitDB\Undo\UndoTransaction.cpp.
'C 22-May-2024 16:06:07.170; captureTryCrash 0xe0434352
’ 4:< ::370:: Delta VM: Avail -4 → 134143510 MB, Used +2 → 2064 MB, Peak +52 → 2113 MB; RAM: Avail -37 → 49289 MB, Used +42 → 2043 MB, Peak +92 → 2094 MB
’ 4:< GUI Resource Usage GDI: Avail 8338, Used 1662, User: Used 660
’ 4:< ANTECEDENT:
'editor ArrowEditor
'inTransaction APITransactionIdentity_1:-1 Dynamo-51297CB5 Script
'requestingFinish of transaction APITransactionIdentity_1 (start):-1 Dynamo-51297CB5 Script
'C 22-May-2024 16:06:15.600; DBG_WARN: Undo phases not properly nested: line 108 of E:\Ship24.1.1\2024_px64\Source\Revit\RevitDB\Undo\UndoCommitPhase.cpp.
’ 8.445562==== 3:<<raiseDocumentChangedEvent
’ 8.483563=== 2:<<EndOrAbortUndoTransaction();DOPT;
’ 1:< API_ERROR { Autodesk.Revit.Exceptions.ModificationForbiddenException exception(Illegal attempt to modify document. Reason: Raising DocumentChanged event) was thrown from a handler of Autodesk.Revit.Proxy.UI.Events.IdlingEventArgsProxy event. The API event handler was registered by application Dynamo For Revit (8d83c886-b739-4acd-a9db-1bc78f315b2b). Changes made by this handler are going to be discarded. }
’ 1:< ANTECEDENT:
'editor ArrowEditor
'C 22-May-2024 16:06:15.605; DBG_WARN: SubTransactionRegistry out of sync; cleaning it out: line 1076 of E:\Ship24.1.1\2024_px64\Source\Revit\RevitDB\Regen\RegenStep.cpp.
'C 22-May-2024 16:06:15.605; 1:< Assertion failed: line 208 of E:\Ship24.1.1\2024_px64\Source\Revit\RevitDB\Undo\UndoAppInfo.cpp

Does this mean that the dynamo file has something burdensome in a Transaction phase?
and ‘InvalidOperationException’ causes the file and Revit itself into shutdown?

Then, I want to know how to control Transaction.Start and Transaction.End among several cumtom packages and python scripts in one .dyn file?
Otherwise, I would like you to teach me what is happening in this error log.

Yusaku

@csys17014

embeding try and except …

i would test your script in general for exceptions before you run it as a standard

events = []

# 🦺 SET PARAMETER
for d,v in zip(doors_collector,vals):
	try:
		door_out_param = d.LookupParameter(SCHLIESSFOLGEREGELUNG).Set(v)
	except:
		import traceback
        events.append(traceback.format_exc())

something like this

Thanks @Draxl_Andreas !!
As a basic notion for constructing codes, it is definitely helpful for me.
:slight_smile: