Jump to solution
Verify

The Fix

Upgrade to version 0.11.4 or later.

Based on closed Kludex/uvicorn issue #529 · PR/commit linked

Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.

Jump to Verify Open PR/Commit
@@ -48,7 +48,6 @@ "asyncio": "uvicorn.loops.asyncio:asyncio_setup", "uvloop": "uvicorn.loops.uvloop:uvloop_setup", - "iocp": "uvicorn.loops.iocp:iocp_setup", } INTERFACES = ["auto", "asgi3", "asgi2", "wsgi"]
repro.py
ERROR: Accept failed on a socket socket: <asyncio.TransportSocket fd=764, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 8000)> Traceback (most recent call last): File "C:\Users\f\scoop\apps\python\current\lib\asyncio\proactor_events.py", line 817, in loop f = self._proactor.accept(sock) File "C:\Users\f\scoop\apps\python\current\lib\asyncio\windows_events.py", line 545, in accept self._register_with_iocp(listener) File "C:\Users\f\scoop\apps\python\current\lib\asyncio\windows_events.py", line 714, in _register_with_iocp _overlapped.CreateIoCompletionPort(obj.fileno(), self._iocp, 0, 0) OSError: [WinError 87] The parameter is incorrect
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\nUpgrade to version 0.11.4 or later.\nWhen NOT to use: This fix is not suitable for applications that rely on IOCP for performance.\n\n

Why This Fix Works in Production

  • Trigger: ERROR: Accept failed on a socket
  • Mechanism: Removes IOCP support and sets the event loop to SelectorEventLoop for Windows with Python 3.8 and above, resolving the reload issue.
  • Why the fix works: Removes IOCP support and sets the event loop to SelectorEventLoop for Windows with Python 3.8 and above, resolving the reload issue. (first fixed release: 0.11.4).
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • Triggered by an upgrade/regression window: 3.8 breaks; 0.11.4 is the first fixed release.
  • Shows up under Python 3.8 in real deployments (not just unit tests).
  • Surfaces as: ERROR: Accept failed on a socket

Proof / Evidence

  • GitHub issue: #529
  • Fix PR: https://github.com/kludex/uvicorn/pull/535
  • First fixed release: 0.11.4
  • Affected versions: 3.8
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.85
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.37

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“This does not repro on py37, reloading works fine there.”
@f0ff886f · 2019-12-19 · repro detail · source
“Right, so the problem here is to do with IOCP”
@lovelydinosaur · 2019-12-19 · source
“~I can trigger the same on windows and 3.7.5~ passing --loop="asyncio" is fine on 3.7.5 passing --loop="asyncio" on 3.8.0 the bug still here”
@euri10 · 2019-12-19 · source
“>Does this only occur when using multiple workers / reload, or does it always occur on Python 3.8 with Windows? I'm not sure I understand…”
@f0ff886f · 2019-12-19 · source

Failure Signature (Search String)

  • ERROR: Accept failed on a socket

Error Message

Stack trace
error.txt
Error Message ------------- ERROR: Accept failed on a socket socket: <asyncio.TransportSocket fd=764, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 8000)> Traceback (most recent call last): File "C:\Users\f\scoop\apps\python\current\lib\asyncio\proactor_events.py", line 817, in loop f = self._proactor.accept(sock) File "C:\Users\f\scoop\apps\python\current\lib\asyncio\windows_events.py", line 545, in accept self._register_with_iocp(listener) File "C:\Users\f\scoop\apps\python\current\lib\asyncio\windows_events.py", line 714, in _register_with_iocp _overlapped.CreateIoCompletionPort(obj.fileno(), self._iocp, 0, 0) OSError: [WinError 87] The parameter is incorrect

Minimal Reproduction

repro.py
ERROR: Accept failed on a socket socket: <asyncio.TransportSocket fd=764, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 8000)> Traceback (most recent call last): File "C:\Users\f\scoop\apps\python\current\lib\asyncio\proactor_events.py", line 817, in loop f = self._proactor.accept(sock) File "C:\Users\f\scoop\apps\python\current\lib\asyncio\windows_events.py", line 545, in accept self._register_with_iocp(listener) File "C:\Users\f\scoop\apps\python\current\lib\asyncio\windows_events.py", line 714, in _register_with_iocp _overlapped.CreateIoCompletionPort(obj.fileno(), self._iocp, 0, 0) OSError: [WinError 87] The parameter is incorrect

Environment

  • Python: 3.8

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

Upgrade to version 0.11.4 or later.

When NOT to use: This fix is not suitable for applications that rely on IOCP for performance.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/kludex/uvicorn/pull/535

First fixed release: 0.11.4

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix is not suitable for applications that rely on IOCP for performance.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
  • Pin production dependencies and upgrade only with a reproducible test that hits the failing path.

Version Compatibility Table

VersionStatus
3.8 Broken
0.11.4 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.