{"record":{"id":"db17c1d66ccecc41","repo":"kovidgoyal/kitty","slug":"invalid-previewer-specification-v-with-error-n-db17c1","errorCode":null,"errorMessage":"invalid previewer specification: %#v with error: no prefix in pattern specification","messagePattern":"invalid previewer specification: %#v with error: no prefix in pattern specification","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/choose_files/main.go","lineNumber":304,"sourceCode":"\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)\n\tparts, err := shlex.Split(ans.Video_preview)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/choose_files/main.go#L286-L322","documentation":"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'.","triggerScenarios":"Passing a spec whose first token is only a pattern, e.g. --previewer '*.png mycommand', with no 'name:' or 'mime:' prefix.","commonSituations":"Forgetting the mime:/name: qualifier; assuming glob-only syntax from other tools (fzf-style).","solutions":["Prefix the pattern: use 'mime:image/*' or 'name:*.png' as the first token","Consult kitty docs for the exact previewer spec grammar"],"exampleFix":"# before\n--previewer '*.png chafa {file}'\n# after\n--previewer 'name:*.png chafa {file}'","handlingStrategy":"validation","validationCode":"if _, _, ok := strings.Cut(parts[0], \":\"); !ok { /* reject spec: missing prefix */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always start specs with name: or mime:","Document the expected grammar next to your config"],"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"}