{"record":{"id":"ee4b0591e5b8b506","repo":"kovidgoyal/kitty","slug":"invalid-previewer-specification-v-with-error-n","errorCode":null,"errorMessage":"invalid previewer specification: %#v with error: no command specified","messagePattern":"invalid previewer specification: %#v with error: no command specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/choose_files/main.go","lineNumber":300,"sourceCode":"\tuse_mimetype bool\n}\n\nfunc (p previewer) matches(fname, mt string) bool {\n\tq := utils.IfElse(p.use_mimetype, mt, fname)\n\tmatched, err := filepath.Match(p.pattern, q)\n\treturn matched && err == nil\n}\n\nvar previewers []previewer\n\nfunc load_previewers(cfg *Config) (err error) {\n\tfor _, spec := range cfg.Previewer {\n\t\tparts, err := shlex.Split(spec)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid previewer specification: %#v with error: %w\", spec, err)\n\t\t}\n\t\tif len(parts) < 2 {\n\t\t\treturn fmt.Errorf(\"invalid previewer specification: %#v with error: no command specified\", spec)\n\t\t}\n\t\tprefix, pattern, found := strings.Cut(parts[0], \":\")\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"invalid previewer specification: %#v with error: no prefix in pattern specification\", spec)\n\t\t}\n\t\tpreviewers = append(previewers, previewer{parts[1:], pattern, prefix == \"mime\"})\n\t}\n\treturn\n}\n\nfunc load_config(opts *Options) (ans *Config, err error) {\n\tans = NewConfig()\n\tp := config.ConfigParser{LineHandler: ans.Parse}\n\terr = p.LoadConfig(\"choose-files.conf\", opts.Config, opts.Override)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tans.KeyboardShortcuts = config.ResolveShortcuts(ans.KeyboardShortcuts)","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/choose_files/main.go#L282-L318","documentation":"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...'.","triggerScenarios":"Passing a spec like '--previewer name:*.png' with no command after the pattern.","commonSituations":"Misreading kitty docs and omitting the command; copy-paste truncation losing the command part.","solutions":["Add the command after the pattern: --previewer 'mime:image/* chafa {file}'","Re-check the previewer syntax in kitty's choose-files documentation"],"exampleFix":"# before\n--previewer 'mime:image/*'\n# after\n--previewer 'mime:image/* chafa --format symbols {file}'","handlingStrategy":"validation","validationCode":"parts, _ := shlex.Split(spec); if len(parts) < 2 { /* reject: no command given */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate previewer specs have pattern AND command","Add config smoke tests in CI"],"tags":["kitty","config","choose-files","previewer"],"backgroundTag":"config-parse-error","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}