{"record":{"id":"d480677ad7853216","repo":"yudai/gotty","slug":"failed-to-return-pong-message-to-master","errorCode":null,"errorMessage":"failed to return Pong message to master","messagePattern":"failed to return Pong message to master","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"webtty/webtty.go","lineNumber":181,"sourceCode":"\tswitch data[0] {\n\tcase Input:\n\t\tif !wt.permitWrite {\n\t\t\treturn nil\n\t\t}\n\n\t\tif len(data) <= 1 {\n\t\t\treturn nil\n\t\t}\n\n\t\t_, err := wt.slave.Write(data[1:])\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to write received data to slave\")\n\t\t}\n\n\tcase Ping:\n\t\terr := wt.masterWrite([]byte{Pong})\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to return Pong message to master\")\n\t\t}\n\n\tcase ResizeTerminal:\n\t\tif wt.columns != 0 && wt.rows != 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tif len(data) <= 1 {\n\t\t\treturn errors.New(\"received malformed remote command for terminal resize: empty payload\")\n\t\t}\n\n\t\tvar args argResizeTerminal\n\t\terr := json.Unmarshal(data[1:], &args)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"received malformed data for terminal resize\")\n\t\t}\n\t\trows := wt.rows\n\t\tif rows == 0 {","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/yudai/gotty/blob/a080c85cbc59226c94c6941ad8c395232d72d517/webtty/webtty.go#L163-L199","documentation":"Wrapped masterWrite failure in handleMasterReadEvent: the terminal received a Ping control message from the browser but writing the Pong reply back over the websocket failed, indicating the master connection is broken (closed, timed out, or write buffer saturated). The pong itself is lost, so the client's keepalive will fail.","triggerScenarios":"Thrown at webtty/webtty.go:181 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat this as a dead master: tear down the session and release the slave","Add write deadlines to masterWrite so saturated sockets fail fast instead of hanging","Client-side: implement reconnect (webtty WithReconnect) to survive transient drops"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a080c85cbc59226c94c6941ad8c395232d72d517","analyzedAt":"2026-09-02T16:42:38.150Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}