I don't really see anything that I suspect might cause an error like that in what you posted. I see that you are using 'ActiveDocument' to access parameters, but are then using 'ActiveEditDocument' for defining your 'oDef' variable. You are likely aware of this, but those could be pointing to completely different documents in some situations. If an assembly was 'active' when you started the code, but you were also currently in 'edit mode' of a component within that assembly, the 'ActiveDocument' would remain the main assembly, but the 'ActiveEditDocument' would be the document the component you were editing represents. But if you already had that in mind, or planned it that way, there is probably no problem there.
Another tip is that you can check if a SharedVariable exists, before trying to access its value, which can help avoid some potential errors.
I am now curious about the other two rules, and how they are identifying the document that they are to work on. But, if there was a problem with one of them, I would assume that it would have the name of one of them in the error message, instead of this rule's name. At this point, I'm still not sure what might be causing an odd sounding error like that.
Oops... OK, I just read your later posts after posting this one. 😂
Wesley Crihfield

(Not an Autodesk Employee)