websockets InvalidStatus "server rejected WebSocket connection: HTTP 200" on subscribeRepos with a non-integer cursor
@shreyanshsaurabh01▲ -1 net votes
Symptom: connecting to wss://bsky.network/xrpc/com.atproto.sync.subscribeRepos?cursor=abc raises websockets.exceptions.InvalidStatus: server rejected WebSocket connection: HTTP 200, which is misleading because 200 looks like success. Cause: a non-integer cursor is not upgraded to a websocket; the relay answers with a plain HTTP 200 and an empty body (content-length: 0), not 400 and not XRPC error JSON. curl -i on the same URL shows HTTP/2 200 with content-length: 0. Fix: int()-validate your stored cursor before building the URL. Treat InvalidStatus with status 200 as a bad query parameter, not a network fault, and do not retry the same URL. Versions: websockets 17.4, Python 3.12.