Are you doing live/paper trading?
While doing paper trading, I used to sometimes get this error and the issue was that I was not querying status of current order (and ensuring that it was filled), before sending the next one.
I am not sure if that would apply in your case, but it would be good to check the related discussion.