kovidgoyal/kitty · error · ValueError

Unknown marker type: {ftype}

Error message

Unknown marker type: {ftype}

What it means

Raised by parse_marker_spec in kitty's option parser when the first token of a marker specification (e.g. in set_marker/toggle_marker actions) is not one of the recognized marker types: 'regex', 'text',', 'function', 'color', etc. It signals the ftype word parsed from the spec did not match any branch of the parser. The error propagates as a config/rc-action parse failure.

Source

Thrown at kitty/options/utils.py:446

            flags |= re.IGNORECASE
        if not parts or len(parts) % 2 != 0:
            raise ValueError('Mark group number and text/regex are not specified in pairs: {}'.format(' '.join(parts)))
        ans = []
        for i in range(0, len(parts), 2):
            try:
                color = max(1, min(int(parts[i]), 3))
            except Exception:
                raise ValueError(f'Mark group in marker specification is not an integer: {parts[i]}')
            sspec = parts[i + 1]
            if 'regex' not in ftype:
                sspec = re.escape(sspec)
            ans.append((color, sspec))
        ftype = 'regex'
        spec: str | tuple[tuple[int, str], ...] = tuple(ans)
    elif ftype == 'function':
        spec = ' '.join(parts)
    else:
        raise ValueError(f'Unknown marker type: {ftype}')
    return ftype, spec, flags


@func_with_args('toggle_marker')
def toggle_marker(func: str, rest: str) -> FuncArgsType:
    parts = rest.split(maxsplit=1)
    if len(parts) != 2:
        raise ValueError(f'{rest} is not a valid marker specification')
    ftype, spec = parts
    parts = list(shlex_split(spec))
    return func, list(parse_marker_spec(ftype, parts))


@func_with_args('scroll_to_mark')
def scroll_to_mark(func: str, rest: str) -> FuncArgsType:
    parts = rest.split()
    if not parts or not rest:
        return func, [True, 0]

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Correct the marker type to a supported one (regex, text, function, color)
  2. Check kitty docs for the action (set_marker/toggle_marker) for the accepted types in your kitty version
  3. If sending remote-control messages, validate the marker spec before sending

Example fix

# before
map f1 set_marker regx ERROR.*
# after
map f1 set_marker regex ERROR.*
Defensive patterns

Strategy: validation

Validate before calling

import re
MARKER_TYPES = {'regex', 'text', 'function', 'color'}
def valid_marker_spec(spec: str) -> bool:
    ftype = spec.split(maxsplit=1)[0].lower()
    return ftype in MARKER_TYPES

Try / catch

try:
    parse_marker_spec(ftype, parts)
except ValueError as e:
    log_config_error(e); fallback_to_default_marker()

Prevention

When it happens

Trigger: Calling set_marker or toggle_marker with a spec whose first word is not a known type, e.g. map f1 set_marker regx foo or launch --type=action set_marker foo bar. Also triggered by parse of mouse_map/remote-control messages containing malformed marker specs.

Common situations: Typos in marker type ('regx' instead of 'regex'), older kitty versions lacking newer marker types, or hand-crafted remote-control JSON payloads with a bad ftype field.

Related errors


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