OAuth2 wsgetmail setup

Currently have installed teh wsgetmail, and setup the O365 side. Im able to connect to O365 but have been stuck with the following error message that I have not been able to resolve. I recieve this only if the mailbox has new emails. Normally if the mailbox is empty then it runs and gives me the processed 0 message.

/usr/local/bin$ wsgetmail --config=wsgetmail.json

fetching mail using configuration wsgetmail.json
failed to run command "/opt/rt5/bin/rt-mailgate " for file /tmp/tX6vc9hJDI.mime : 19200 at /usr/local/share/perl/5.30.0/App/wsgetmail/MDA.pm line 204.


I get the same failed message. Any solutions?