Please see the Troubleshooting & Support section of the TWS API documentation for general troubleshooting suggestions and logging instructions.
Error messages sent by the TWS are handled by the EWrapper.error() callback function. When an error event occurs, it will be delivered to error(), and will contain the originating request/order ID (if applicable), a numeric error code and a brief description of the error. For further information on error handling and associated error codes, please consult the TWS API documentation.