kovidgoyal/kitty · error
Could not detect the MIME type for
Error message
Could not detect the MIME type for: %s use --mime to specify it manually
What it means
In run_get_loop, when no --mime was supplied the kitten guesses the MIME type of the destination argument (e.g. from its extension via utils.GuessMimeType, with special handling for kitty-supported text types). If guessing yields an empty string, it errors asking you to specify --mime manually.
Solutions
- Pass --mime explicitly: `kitten clipboard get --mime application/octet-stream data.bin`
- Name the destination with a recognized extension (e.g. .png, .txt, .json)
- When scripting, first query available types and map them yourself before calling get
Example fix
# before kitten clipboard get /tmp/clip.blob # after kitten clipboard get --mime image/png /tmp/clip.blob
Defensive patterns
Strategy: validation
Validate before calling
# require a known extension or explicit --mime
case "$DEST" in *.png|*.txt|*.json) ;; *) MIME="${MIME:-application/octet-stream}";; esac
[ -n "$MIME" ] && set -- --mime "$MIME" "$@" Prevention
- Always pass --mime for extensionless destinations
- Use recognized extensions for output files
When it happens
Trigger: `kitten clipboard get data.bin` where .bin (or no extension) has no known MIME mapping; destination files with unusual or missing extensions that GuessMimeType does not recognize.
Common situations: Downloading clipboard blobs to extensionless temp files; custom binary formats; tools scripting getfile with generated filenames like /tmp/clip.$$.
Related errors
- Failed to encode image data to
- The MIME type for not available on the clipboard
- Aborted by user!
- cannot use --human-name or --password in filter mode
- Clipboard alias request has no MIME type, aborting the…
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/c55e08b4e046081e.
Report an issue: GitHub.
Appendix: source
Thrown at kittens/clipboard/read.go:317
outputs := make([]*Output, len(args))
aliases, merr := parse_aliases(opts.Alias)
if merr != nil {
return merr
}
for i, arg := range args {
outputs[i] = &Output{arg: arg, arg_is_stream: arg == "/dev/stdout" || arg == "/dev/stderr", ext: filepath.Ext(arg)}
if len(opts.Mime) > i {
outputs[i].mime_type = opts.Mime[i]
} else {
if outputs[i].arg_is_stream {
outputs[i].mime_type = "text/plain"
} else {
outputs[i].mime_type = utils.GuessMimeType(outputs[i].arg)
}
}
if outputs[i].mime_type == "" {
return fmt.Errorf("Could not detect the MIME type for: %s use --mime to specify it manually", arg)
}
}
defer func() {
for _, o := range outputs {
if o.dest != nil {
o.cleanup()
}
}
}()
basic_metadata := map[string]string{"type": "read"}
if opts.UsePrimary {
basic_metadata["loc"] = "primary"
}
lp.OnInitialize = func() (string, error) {
lp.QueueWriteString(encode(basic_metadata, "."))
if opts.Password != "" {View on GitHub (pinned to 6d5d0c4406)