Messages/Applescript throws SOHelper error
I am trying to implement an AppleScript which extracts a code from the received message when specific keywords are found. The script works as long as no notification will pop up on received message, eg. when Messages is frontmost window. When I am in another app and receive the Message Notification the SOHelper error will be thrown and the script will not work.
SOHelper error:
03.05.15 14:38:23.846 soagent[7075]: Can't allocate SOHelper <SOMessageHelper: 0x7f85f0f8f9c0> inside com.apple.soagent
Any idea what else needs to be done to get that to work?
MacBook Air, OS X Yosemite (10.10.3)