Best guess is that you are passing in some parameter that does not make sense to TWS and causes the rejection. If you were able to pass the same exact trade into the paper trade system and got executed there, the real time system has additional constrictions on size as well. It will not execute a 40 contract order on silver futures if the market at the bid is showing a size of 3 or 5.
To troubleshoot, I would try to submit for execution the same instrument you are trading with very small size, and as a market order. If it gets executed, at least you will know that you have the contract information correct and then submit a more complex order until you see where you start getting rejected.