kovidgoyal/kitty · error
invalid previewer specification: %#v with error: no prefix i
Error message
invalid previewer specification: %#v with error: no prefix in pattern specification
What it means
The first shell word of the previewer spec did not contain a ':' separating the prefix (name or mime) from the pattern. Kitty requires the spec to start with 'prefix:pattern'.
Source
Thrown at kittens/choose_files/main.go:304
q := utils.IfElse(p.use_mimetype, mt, fname)
matched, err := filepath.Match(p.pattern, q)
return matched && err == nil
}
var previewers []previewer
func load_previewers(cfg *Config) (err error) {
for _, spec := range cfg.Previewer {
parts, err := shlex.Split(spec)
if err != nil {
return fmt.Errorf("invalid previewer specification: %#v with error: %w", spec, err)
}
if len(parts) < 2 {
return fmt.Errorf("invalid previewer specification: %#v with error: no command specified", spec)
}
prefix, pattern, found := strings.Cut(parts[0], ":")
if !found {
return fmt.Errorf("invalid previewer specification: %#v with error: no prefix in pattern specification", spec)
}
previewers = append(previewers, previewer{parts[1:], pattern, prefix == "mime"})
}
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
}View on GitHub (pinned to 6d5d0c4406)
Solutions
- Prefix the pattern: use 'mime:image/*' or 'name:*.png' as the first token
- Consult kitty docs for the exact previewer spec grammar
Example fix
# before
--previewer '*.png chafa {file}'
# after
--previewer 'name:*.png chafa {file}' Defensive patterns
Strategy: validation
Validate before calling
if _, _, ok := strings.Cut(parts[0], ":"); !ok { /* reject spec: missing prefix */ } Prevention
- Always start specs with name: or mime:
- Document the expected grammar next to your config
When it happens
Trigger: Passing a spec whose first token is only a pattern, e.g. --previewer '*.png mycommand', with no 'name:' or 'mime:' prefix.
Common situations: Forgetting the mime:/name: qualifier; assuming glob-only syntax from other tools (fzf-style).
Related errors
- invalid previewer specification: %#v with error: no command
- invalid previewer specification: %#v with error: %w
- invalid value %s in video_preview
- This should be run as kitten broadcast
- No option named: {k}
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/db17c1d66ccecc41.
Report an issue: GitHub.