MT5 Python error -10002: IPC receive failed (RES_E_INTERNAL_FAIL_RECEIVE)
The command reached the terminal but its answer never came back to Python. An order may have executed; check before resending.
What it means
You see this code in mt5.last_error() in Python, after a package call returns None or False.
The package sent the call, then failed to read the answer. The terminal may have done the work.
For order_send this is the dangerous case. The trade may be open even though Python got nothing back.
Common causes
- The terminal crashed or restarted while handling the call.
- The connection broke after the command left Python.
- A heavy load on the machine that stalled the terminal.
How to fix it
- Reconnect, then read positions, orders and recent deals for your magic number and comment.
- Resend only if there is no trace of the order.
- Give each order a unique comment so you can find it.
Example in Python:
import MetaTrader5 as mt5
request["comment"] = "job-4711"
r = mt5.order_send(request)
if r is None and mt5.last_error()[0] == -10002:
mt5.shutdown(); mt5.initialize()
mine = [p for p in mt5.positions_get(symbol=request["symbol"]) or ()
if p.comment == "job-4711"]
print("already open" if mine else "no trace yet, check deals too") Is it safe to retry?
Not until you have checked the account.
Could the order have executed?
Maybe. The terminal may have sent the order to the broker.
How Tickwire handles it
On Tickwire, a trade whose answer is unclear is never sent again with new exposure. Tickwire looks for its effect and reports applied, rejected or unknown. See when the answer is unknown.
Related codes
- MT5 error 10031: No connection with the trade server (TRADE_RETCODE_CONNECTION)
- MT5 Python error -10005: IPC timeout (RES_E_INTERNAL_FAIL_TIMEOUT)
- MT5 Python error -10001: IPC send failed (RES_E_INTERNAL_FAIL_SEND)
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.