# IBKR TimeoutError() in ib_async after login

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/guides/ibkr-ib-async-timeouterror, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Two reports on the ib_async issue tracker describe IB Gateway accepting a connection and closing it straight after login, one surfacing as TimeoutError(). Both were read through the GitHub API on 30 November 2026, and both have since been closed with an answer from the maintainers. What the answers say to check.

- Checked: 2026-11-30
- For: Python users of ib_async whose IB Gateway connection drops straight after a successful login
- About: [Interactive Brokers](https://openbrokerapi.com/brokers/ibkr)

## Steps

### 1. The first report: TimeoutError() straight after Connected

Issue 143, opened on 25 April 2025 with ib_async 1.0.3 against IB Gateway 10.30.1 on macOS, shows the log lines Connecting and Connected followed by TimeoutError(). A first reply on 7 May 2025 suggested removing the timeout argument from ib.connect. The maintainer's answer of 23 October 2026 says the Gateway accepted the socket and then closed it right after the API start message, which means the Gateway itself refused the session, and lists the usual causes: a clientId still held by a stale session, so restart the Gateway or try another id; the Gateway waiting for you to accept the incoming connection; the client's IP address missing from Trusted IPs; or the Gateway still logging in or restarting. The issue is closed.

Status: verified. Source: [github.com](https://github.com/ib-api-reloaded/ib_async/issues/143), checked 2026-11-30.

### 2. The second report: a script that connects and then ends

Issue 169, opened on 12 August 2025 on Windows 11 with ib_async 2.0.1 and IB Gateway 10.30, describes a connection that drops immediately after a successful handshake, with TWS working and the Gateway not. Replies over the following year suggested checking the Gateway's API settings (Enable ActiveX and Socket Clients, trusted IPs) and the Gateway log. The maintainer's answer of 23 October 2026 is different from the first issue's: the script posted connects, prints and then ends, so Python exits and the connection closes, which IB Gateway shows as a disconnect right after login. To keep the session open, keep the program running: call ib.run() at the end, or do the work with ib.sleep between requests. The issue is closed.

Status: verified. Source: [github.com](https://github.com/ib-api-reloaded/ib_async/issues/169), checked 2026-11-30.

### 3. What to check, in the order the answers give

First, whether your script has anything to do after connect: a script that only connects and prints will exit, and the Gateway reports that exit as a dropped connection. Second, the Gateway's API settings and whether the client's address is in Trusted IPs, or whether the Gateway is waiting for you to accept the incoming connection in its own window. Third, the clientId: restart the Gateway or use another id if a stale session still holds it. Fourth, timing: a Gateway that is still logging in or restarting refuses sessions. ib_async's README asks for Python 3.10 or later and installs with pip install ib_async. None of this has been reproduced by this site; it is what the maintainers wrote on the two threads.

Status: verified. Source: [github.com](https://github.com/ib-api-reloaded/ib_async/issues/169), checked 2026-11-30.

## Sources

- Status: verified. Source: [ib_async issue 143: Api connection failed](https://github.com/ib-api-reloaded/ib_async/issues/143), checked 2026-11-30.
- Status: verified. Source: [ib_async issue 169: connection drops immediately after successful API connection](https://github.com/ib-api-reloaded/ib_async/issues/169), checked 2026-11-30.
- Status: verified. Source: [ib_async repository README](https://github.com/ib-api-reloaded/ib_async), checked 2026-11-30.

## More on the Interactive Brokers API

- [Interactive Brokers API quickstart](https://openbrokerapi.com/brokers/ibkr/quickstart): From credentials to a first call on a demo account, step by step.
- [Interactive Brokers API error codes](https://openbrokerapi.com/errors/ibkr): 511 decoded, each with what it means, and the fix where the source gives one.
- [Interactive Brokers API endpoints](https://openbrokerapi.com/brokers/ibkr/endpoints): 23 documented, each with its method, path, parameters and source.
- [Interactive Brokers API page](https://openbrokerapi.com/brokers/ibkr): The full record: access, authentication, limits and the source for each.
- [Get your Interactive Brokers trade history into a spreadsheet](https://openbrokerapi.com/guides/ibkr-trade-history): Guide
- [ib_async vs ib_insync: which one is maintained, and which is archived](https://openbrokerapi.com/guides/ib-async-vs-ib-insync): Guide
- [IBKR API without TWS: headless IB Gateway options](https://openbrokerapi.com/guides/ibkr-headless-gateway): Guide
- [The three Interactive Brokers REST front doors compared](https://openbrokerapi.com/guides/ibkr-rest-front-doors): Guide

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: IBKR TimeoutError() in ib_async after login. Broker API Hub, https://openbrokerapi.com/guides/ibkr-ib-async-timeouterror, newest check 2026-11-30.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
