kovidgoyal/kitty · error

Invalid response from terminal to %s query: %#v

Error message

Invalid response from terminal to %s query: %#v

What it means

After the terminal answers a capability query, the response value is parsed as a float (font size, cell metrics). If parsing fails, this error reports the offending query key and raw value. It indicates the terminal returned a malformed numeric response.

Source

Thrown at kittens/choose_fonts/ui.go:123

func (h *handler) finalize() {
	if h.temp_dir != "" {
		os.RemoveAll(h.temp_dir)
		h.temp_dir = ""
	}
	h.lp.SetCursorVisible(true)
	h.lp.SetCursorShape(loop.BLOCK_CURSOR, true)
	h.graphics_manager.finalize()
}

func (h *handler) on_query_response(key, val string, valid bool) error {
	if !valid {
		return fmt.Errorf("Terminal does not support querying the: %s", key)
	}
	set_float := func(k, v string, dest *float64) error {
		if fs, err := strconv.ParseFloat(v, 64); err == nil {
			*dest = fs
		} else {
			return fmt.Errorf("Invalid response from terminal to %s query: %#v", k, v)
		}
		return nil
	}
	switch key {
	case "font_size":
		if err := set_float(key, val, &h.text_style.Font_sz); err != nil {
			return err
		}
	case "dpi_x":
		if err := set_float(key, val, &h.text_style.Dpi_x); err != nil {
			return err
		}
	case "dpi_y":
		if err := set_float(key, val, &h.text_style.Dpi_y); err != nil {
			return err
		}
	case "foreground":
		h.text_style.Foreground = val

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Run inside real kitty without multiplexer interference
  2. Disable shell integration/prompt escape codes that answer queries incorrectly
  3. Update kitty to latest version
Defensive patterns

Strategy: validation

Validate before calling

if _, err := strconv.ParseFloat(val, 64); err != nil {
	return fmt.Errorf("terminal sent garbage for %s: %q", key, val)
}

Try / catch

if err := set_float(key, val, &dest); err != nil { /* treat terminal as incapable, fall back to defaults */ }

Prevention

When it happens

Trigger: Terminal sends a non-numeric reply to the font_size or cell-width/height query (e.g. empty string or garbage), which strconv.ParseFloat rejects.

Common situations: Interference from shell prompt escape sequences corrupting query responses, tmux/screen mangling DCS replies, or a non-kitty terminal echoing the query back.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/63e62c58a20e67d4. Report an issue: GitHub.