kovidgoyal/kitty · error

The MIME type for not available on the clipboard

Error message

The MIME type %s for %s not available on the clipboard

What it means

assign_mime_type walks the available MIME types on the clipboard (including aliases) looking for the requested type, with a fallback to text/plain when a text type is requested. If nothing matches, it reports that the requested MIME type for the given argument is not available on the clipboard.

Solutions

  1. List what is actually available first: `kitten clipboard get` with no --mime prints/uses available types, or inspect the DATA status
  2. Add an alias mapping: `--alias image/bmp=image/png` if the source uses a related format
  3. Copy the data again on the sender in the format you need (e.g. copy image, not text)
  4. Request text/plain, which falls back across text types

Example fix

# before
kitten clipboard get --mime image/png out.bin   # clipboard holds text only
# after
kitten clipboard get --mime text/plain out.txt
Defensive patterns

Strategy: fallback

Try / catch

kitten clipboard get --mime image/png out 2>/dev/null || kitten clipboard get --mime text/plain out.txt

Prevention

When it happens

Trigger: `kitten clipboard get --mime image/png` when the clipboard only holds text/plain; requesting a specific type after the sender copied a different format; alias map (from --alias) not covering the format actually present.

Common situations: Copying from apps that register custom MIME types (e.g. text/x-custom) then requesting the standard one without an --alias; racing: reading the clipboard after its owner replaced the content with a different format; assuming image data is present when only text was copied.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/6dc272eaea61fa63. Report an issue: GitHub.

Appendix: source

Thrown at kittens/clipboard/read.go:185

	}
	if images.EncodableImageTypes[self.mime_type] {
		for _, mt := range available_mimes {
			if images.DecodableImageTypes[mt] {
				self.remote_mime_type = mt
				self.image_needs_conversion = true
				return
			}
		}
	}
	if is_textual_mime(self.mime_type) {
		for _, mt := range available_mimes {
			if mt == "text/plain" {
				self.remote_mime_type = mt
				return
			}
		}
	}
	return fmt.Errorf("The MIME type %s for %s not available on the clipboard", self.mime_type, self.arg)
}

func escape_metadata_value(k, x string) (ans string) {
	if k == "mime" {
		x = base64.StdEncoding.EncodeToString(utils.UnsafeStringToBytes(x))
	}
	return x
}

func unescape_metadata_value(k, x string) (ans string) {
	if k == "mime" {
		b, err := base64.StdEncoding.DecodeString(x)
		if err == nil {
			x = string(b)
		}
	}
	return x
}

View on GitHub (pinned to 6d5d0c4406)