kovidgoyal/kitty · error

unrecognized key in video_preview: %s

Error message

unrecognized key in video_preview: %s

What it means

A key in the video_preview setting is not one of the recognized keys (duration, fps, width). kitty rejects unknown keys to catch typos.

Source

Thrown at kittens/choose_files/main.go:345

		}
		var i uint64
		switch k {
		case "duration":
			if video_duration, err = strconv.ParseFloat(v, 64); err != nil {
				return nil, fmt.Errorf("invalid %s in video_preview: %s", k, v)
			}
		case "fps":
			if i, err = strconv.ParseUint(v, 10, 0); err != nil {
				return nil, fmt.Errorf("invalid %s in video_preview: %s", k, v)
			}
			video_fps = int(i)
		case "width":
			if i, err = strconv.ParseUint(v, 10, 0); err != nil {
				return nil, fmt.Errorf("invalid %s in video_preview: %s", k, v)
			}
			video_width = int(i)
		default:
			return nil, fmt.Errorf("unrecognized key in video_preview: %s", k)
		}
	}
	return ans, nil
}

func (h *Handler) init_sizes(new_size loop.ScreenSize) {
	h.screen_size.width = int(new_size.WidthCells)
	h.screen_size.height = int(new_size.HeightCells)
	h.screen_size.cell_width = int(new_size.CellWidth)
	h.screen_size.cell_height = int(new_size.CellHeight)
	h.screen_size.width_px = int(new_size.WidthPx)
	h.screen_size.height_px = int(new_size.HeightPx)
	h.rl.ClearCachedScreenSize()
	h.search_rl.ClearCachedScreenSize()
}

func (h *Handler) OnInitialize() (ans string, err error) {
	if sz, err := h.lp.ScreenSize(); err != nil {

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Remove or correct the key — only duration, fps, width are valid
  2. Check kitty docs for the current video_preview keys

Example fix

# before
--video-preview 'fps=10,height=24'
# after
--video-preview 'fps=10,width=24'
Defensive patterns

Strategy: validation

Validate before calling

switch k { case "duration", "fps", "width": default: /* reject unknown key */ }

Prevention

When it happens

Trigger: --video-preview 'height=24' or 'frame-rate=10' — any key other than duration/fps/width.

Common situations: Typos ('duraton'), renamed settings, or assuming other player options are accepted.

Related errors


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