kovidgoyal/kitty · error

invalid value %s in video_preview

Error message

invalid value %s in video_preview

What it means

A comma-separated item in the video_preview setting has no '=' separator, so kitty cannot parse it as key=value. Valid keys are duration, fps, and width.

Source

Thrown at kittens/choose_files/main.go:326

	return
}

func load_config(opts *Options) (ans *Config, err error) {
	ans = NewConfig()
	p := config.ConfigParser{LineHandler: ans.Parse}
	err = p.LoadConfig("choose-files.conf", opts.Config, opts.Override)
	if err != nil {
		return nil, err
	}
	ans.KeyboardShortcuts = config.ResolveShortcuts(ans.KeyboardShortcuts)
	parts, err := shlex.Split(ans.Video_preview)
	if err != nil {
		return nil, err
	}
	for _, x := range parts {
		k, v, found := strings.Cut(x, "=")
		if !found {
			return nil, fmt.Errorf("invalid value %s in video_preview", x)
		}
		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:

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Rewrite each item as key=value: --video-preview 'duration=5,fps=10,width=80'
  2. Remove stray items that are not key=value pairs

Example fix

# before
--video-preview '5,10,80'
# after
--video-preview 'duration=5,fps=10,width=80'
Defensive patterns

Strategy: validation

Validate before calling

for _, x := range strings.Split(val, ",") { if !strings.Contains(x, "=") { /* reject item */ } }

Prevention

When it happens

Trigger: Setting --video-preview to something like '30fps' or a bare number instead of 'fps=30'.

Common situations: Assuming positional/flag syntax; typos like 'duration:' instead of 'duration='.

Related errors


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