I'm not very good with scripting yet so I didn't totally understand what you meant in the above, but it was enough to make me realize that using a dome object in my ceiling fan was the problem. I used a complex profile to make my globe for the light instead and now everything is ok.
I am glad you got this solved in other ways, but in possible answer to the question, it is most likely that your script is requesting a variable of one type, ie. a number, but that parameter is actually defined as something else such as text. This type of mismatch will generate the error message you have.
AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K
Search & Replace <ind(material,bod_mat)> by <bod_mat>
Search & Replace <ind(material,han_mat)> by <han_mat>
Search & Replace <"DEFAULT"> by <bod_mat>, except for the last one, replace by <han_mat>
Search & Replace <"09 | Paint-01 Ceiling White"> by <ceil_mat>.
You will have to create a new material <ceil_mat>
It takes about two minuts. Attached the rectified script. No more alerts.