kovidgoyal/kitty · error
invalid previewer specification: %#v with error: no command
Error message
invalid previewer specification: %#v with error: no command specified
What it means
The previewer spec tokenized into fewer than 2 shell words, meaning only a pattern was given with no command to run. Every previewer needs 'prefix:pattern command args...'.
Source
Thrown at kittens/choose_files/main.go:300
use_mimetype bool
}
func (p previewer) matches(fname, mt string) bool {
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)View on GitHub (pinned to 6d5d0c4406)
Solutions
- Add the command after the pattern: --previewer 'mime:image/* chafa {file}'
- Re-check the previewer syntax in kitty's choose-files documentation
Example fix
# before
--previewer 'mime:image/*'
# after
--previewer 'mime:image/* chafa --format symbols {file}' Defensive patterns
Strategy: validation
Validate before calling
parts, _ := shlex.Split(spec); if len(parts) < 2 { /* reject: no command given */ } Prevention
- Validate previewer specs have pattern AND command
- Add config smoke tests in CI
When it happens
Trigger: Passing a spec like '--previewer name:*.png' with no command after the pattern.
Common situations: Misreading kitty docs and omitting the command; copy-paste truncation losing the command part.
Related errors
- invalid previewer specification: %#v with error: no prefix i
- 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/ee4b0591e5b8b506.
Report an issue: GitHub.