{"record":{"id":"8b3378fac74e878b","repo":"yudai/gotty","slug":"received-malformed-data-for-terminal-resize","errorCode":null,"errorMessage":"received malformed data for terminal resize","messagePattern":"received malformed data for terminal resize","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"webtty/webtty.go","lineNumber":196,"sourceCode":"\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 {\n\t\t\trows = int(args.Rows)\n\t\t}\n\n\t\tcolumns := wt.columns\n\t\tif columns == 0 {\n\t\t\tcolumns = int(args.Columns)\n\t\t}\n\n\t\twt.slave.ResizeTerminal(columns, rows)\n\tdefault:\n\t\treturn errors.Errorf(\"unknown message type `%c`\", data[0])\n\t}\n\n\treturn nil\n}","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/yudai/gotty/blob/a080c85cbc59226c94c6941ad8c395232d72d517/webtty/webtty.go#L178-L214","documentation":"Wrapped json.Unmarshal error on a ResizeTerminal control message: the payload after the message-type byte is not valid JSON for {Columns, Rows} — truncated frames, garbage bytes, or numbers as strings. Guarded by an earlier empty-payload check, so this specifically means unparseable JSON from the master client.","triggerScenarios":"Thrown at webtty/webtty.go:196 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the client to send {\\\"Columns\\\":n,\\\"Rows\\\":n} as raw JSON after the '2' command byte","Validate/normalize outgoing resize messages in client tooling","Ignore malformed resize frames and keep the session alive instead of dropping it"],"exampleFix":null,"handlingStrategy":"validation","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"}