yudai/gotty · error

unknown message type `%c`

Error message

unknown message type `%c`

What it means

Default-branch guard in handleMasterReadEvent: the first byte of a master message does not match any known protocol message type (input '0', ping '1', resize '2'), so the frame is treated as an unknown/protocol-violating message and the read loop errors out, killing the session.

Source

Thrown at webtty/webtty.go:210

		var args argResizeTerminal
		err := json.Unmarshal(data[1:], &args)
		if err != nil {
			return errors.Wrapf(err, "received malformed data for terminal resize")
		}
		rows := wt.rows
		if rows == 0 {
			rows = int(args.Rows)
		}

		columns := wt.columns
		if columns == 0 {
			columns = int(args.Columns)
		}

		wt.slave.ResizeTerminal(columns, rows)
	default:
		return errors.Errorf("unknown message type `%c`", data[0])
	}

	return nil
}

type argResizeTerminal struct {
	Columns float64
	Rows    float64
}

View on GitHub (pinned to a080c85cbc)

Solutions

  1. Ensure the client prefixes every frame with the correct protocol byte
  2. Upgrade mismatched client/server pairs sharing the websocket
  3. Log the offending byte to identify which client implementation is misbehaving
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at webtty/webtty.go:210 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/1919b04b83608874. Report an issue: GitHub.