MT5 Python error -10000: IPC internal error (RES_E_INTERNAL_FAIL)

The link between Python and the terminal failed in a general way. Shut down the connection, start it again, and check the terminal.

-10000RES_E_INTERNAL_FAIL
Yes, after a waitSafe to retry?
MaybeCould it have executed?

What it means

You see this code in mt5.last_error() in Python, after a package call returns None or False.

The package talks to a running terminal through a local channel (IPC). Codes from -10000 to -10005 are about that channel, not about the broker.

-10000 is the general one: something in that channel broke.

Common causes

  • The terminal froze, closed or restarted.
  • Two Python processes using the same terminal at once.
  • A terminal that is still loading.

How to fix it

  • Call mt5.shutdown(), wait a moment, then mt5.initialize() again.
  • Use one Python process per terminal.
  • Restart the terminal if it keeps happening.

Example in Python:

import time
import MetaTrader5 as mt5

def connect(attempts=3, **kw):
    for i in range(attempts):
        if mt5.initialize(**kw):
            return True
        print("initialize failed:", mt5.last_error())
        mt5.shutdown()
        time.sleep(2 * (i + 1))
    return False

Is it safe to retry?

Yes, after reconnecting.

Could the order have executed?

Maybe. If it happened during order_send, check positions and deals before sending again.

How Tickwire handles it

With Tickwire your code calls a REST API from any operating system. You don't install this package or keep a terminal running yourself. See the MT5 Python API page.

All MetaTrader error codes

All MetaTrader5 Python functions

One API for MT4 and MT5

Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.