aio-libs/aiohttp · error · HTTPBadRequest
No CONNECTION upgrade hdr: {headers.get(hdrs.CONNECTION)}
Error message
No CONNECTION upgrade hdr: {headers.get(hdrs.CONNECTION)} What it means
Error "No CONNECTION upgrade hdr: {headers.get(hdrs.CONNECTION)}" thrown in aio-libs/aiohttp.
Source
Thrown at aiohttp/web_ws.py:283
assert payload_writer is not None
self._post_start(request, protocol, writer)
await payload_writer.drain()
return payload_writer
def _handshake(
self, request: BaseRequest
) -> tuple["CIMultiDict[str]", str | None, int, bool]:
headers = request.headers
if "websocket" != headers.get(hdrs.UPGRADE, "").lower().strip():
raise HTTPBadRequest(
text=(
f"No WebSocket UPGRADE hdr: {headers.get(hdrs.UPGRADE)}\n Can "
'"Upgrade" only to "WebSocket".'
)
)
if not request._message.upgrade:
raise HTTPBadRequest(
text=f"No CONNECTION upgrade hdr: {headers.get(hdrs.CONNECTION)}"
)
# find common sub-protocol between client and server
protocol: str | None = None
if hdrs.SEC_WEBSOCKET_PROTOCOL in headers:
req_protocols = [
str(proto.strip())
for proto in headers[hdrs.SEC_WEBSOCKET_PROTOCOL].split(",")
]
for proto in req_protocols:
if proto in self._protocols:
protocol = proto
break
else:
# No overlap found: Return no protocol as per spec
ws_logger.warning(View on GitHub (pinned to c0ef574e29)
When it happens
Trigger: Thrown at aiohttp/web_ws.py:283 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of aio-libs/aiohttp@c0ef574e29 (2026-08-04).
Data as JSON: /data/errors/276506429232aa7c.json.
Report an issue: GitHub.