MT5 Python error -10001: IPC send failed (RES_E_INTERNAL_FAIL_SEND)
Python couldn't pass the command to the terminal. The terminal is likely closed or stuck; reconnect before anything else.
What it means
You see this code in mt5.last_error() in Python, after a package call returns None or False.
The package tried to hand the call over to the terminal and the handover failed. The terminal didn't get the command.
It usually means the terminal went away between two calls.
Common causes
- The terminal was closed or crashed.
- The terminal is frozen and not reading commands.
- The connection was shut down by another part of your program.
How to fix it
- Reconnect with
mt5.shutdown()andmt5.initialize(). - Watch the terminal process and restart it if it dies.
- After reconnecting, read positions and orders before trading again.
Example in Python:
import MetaTrader5 as mt5
r = mt5.order_send(request)
if r is None and mt5.last_error()[0] == -10001:
mt5.shutdown()
if mt5.initialize():
# The command most likely never arrived, but look before resending.
print(mt5.positions_get(symbol=request["symbol"])) Is it safe to retry?
Check first. Usually yes after reconnecting, but read the account first when the call was a trade.
Could the order have executed?
Maybe. Unlikely, because the command didn't reach the terminal. You can't see that from Python for certain, so check.
Without the Python package
With Tickwire your code calls a REST API from any operating system, so this package error doesn't come up. See the MT5 Python API page.
Related codes
- MT5 Python error -10002: IPC receive failed (RES_E_INTERNAL_FAIL_RECEIVE)
- MT5 Python error -10004: No IPC connection (RES_E_INTERNAL_FAIL_CONNECT)
- MT5 Python error -10000: IPC internal error (RES_E_INTERNAL_FAIL)
Related MT5 Python functions
One API for MT4 and MT5
Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.