yudai/gotty · error
Method not allowed
Error message
Method not allowed
What it means
Plain 405 response from the WS handler guard: the HTTP method of the upgrade request is not GET, which is required by the websocket handshake, so the connection is rejected before any upgrade or auth is attempted.
Solutions
- Send websocket upgrade requests as GET only
- Fix client code accidentally POST/PUT-ing to the ws URL
- Check for proxies rewriting the method in front of the server
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/handlers.go:64 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of yudai/gotty@a080c85cbc (2026-09-02).
Data as JSON: /api/errors/cefba20e2341e88d.
Report an issue: GitHub.
Appendix: source
Thrown at server/handlers.go:64
closeReason, r.RemoteAddr, num, server.options.MaxConnection,
)
if server.options.Once {
cancel()
}
}()
if int64(server.options.MaxConnection) != 0 {
if num > server.options.MaxConnection {
closeReason = "exceeding max number of connections"
return
}
}
log.Printf("New client connected: %s, connections: %d/%d", r.RemoteAddr, num, server.options.MaxConnection)
if r.Method != "GET" {
http.Error(w, "Method not allowed", 405)
return
}
conn, err := server.upgrader.Upgrade(w, r, nil)
if err != nil {
closeReason = err.Error()
return
}
defer conn.Close()
err = server.processWSConn(ctx, conn)
switch err {
case ctx.Err():
closeReason = "cancelation"
case webtty.ErrSlaveClosed:
closeReason = server.factory.Name()
case webtty.ErrMasterClosed:View on GitHub (pinned to a080c85cbc)