kovidgoyal/kitty · error

%s is not valid MIME alias specification

Error message

%s is not valid MIME alias specification

What it means

--alias values must be of the form FROM=TO. parse_aliases splits each entry on the first '=' and rejects any entry lacking one, reporting the offending string. Each alias is registered bidirectionally (both directions map to each other).

Source

Thrown at kittens/clipboard/read.go:281

			rp := bytes.SplitN(record, utils.UnsafeStringToBytes("="), 2)
			v := ""
			if len(rp) == 2 {
				v = string(rp[1])
			}
			k := string(rp[0])
			metadata[k] = unescape_metadata_value(k, v)
		}
	}

	return
}

func parse_aliases(raw []string) (map[string][]string, error) {
	ans := make(map[string][]string, len(raw))
	for _, x := range raw {
		k, v, found := strings.Cut(x, "=")
		if !found {
			return nil, fmt.Errorf("%s is not valid MIME alias specification", x)
		}
		ans[k] = append(ans[k], v)
		ans[v] = append(ans[v], k)
	}
	return ans, nil
}

func run_get_loop(opts *Options, args []string) (err error) {
	lp, err := loop.NewForSimpleInteraction()
	if err != nil {
		return err
	}
	var available_mimes []string
	var wg sync.WaitGroup
	var getting_data_for string
	requested_mimes := make(map[string]*Output)
	reading_available_mimes := true
	outputs := make([]*Output, len(args))

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use '=' syntax: `--alias image/bmp=image/png`
  2. For multiple aliases repeat the flag: `--alias a=b --alias b=c`
  3. Verify shell quoting: `--alias "$a=$b"` when composing from variables

Example fix

# before
kitten clipboard get --alias image/bmp image/png out
# after
kitten clipboard get --alias image/bmp=image/png out
Defensive patterns

Strategy: validation

Validate before calling

for a in "${ALIASES[@]}"; do [[ "$a" == *=* ]] || { echo "bad alias: $a"; exit 2; }; done

Prevention

When it happens

Trigger: Passing `--alias image/png` (no '='), `--alias image/png image/jpeg` (space instead of '='), or an empty --alias value; also `--alias =` style degenerate entries still parse but map empty strings.

Common situations: Users writing alias pairs space-separated as if they were two flags; shell quoting that strips the equals sign; scripts building alias lists that skip the '=' when the target is empty.

Related errors


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