Edited post as original post was not relevant to actual fix.
This was weird error. My command timeout was set too high. I was getting “out of range exception”.
I reduced the timeout value and it started working fine. No idea why
You can delete this thread.