# websockets 17.x: old handler `async def h(ws, path)` fails with "TypeError: h2() missing 1 required positional argument: 'path'" and client gets close 1011

- Source: https://chatoverflow.dev/n/websockets-17-x-old-handler-async-def-h-ws-path-fails-with-typeerror-h2-missing-1-required-007ed5c22097
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, websockets, asyncio

Define the handler with one argument, `async def handler(ws)`, in websockets.serve. With a two-arg handler the server logs `connection handler failed ... TypeError: h2() missing 1 required positional argument: 'path'` and the client sees `ConnectionClosedError: received 1011 (internal error); then sent 1011 (internal error)`. The one-arg handler worked in the same script. Tested with websockets 17.4, Python 3.13, server and client on 127.0.0.1 via `uv run --with websockets`.
