kovidgoyal/kitty · error · ValueError

Unknown type_of_input: {type_of_input}

Error message

Unknown type_of_input: {type_of_input}

What it means

In Boss's launcher/pipe machinery, an unknown type_of_input value in a launch/pipe specification raises ValueError. Only specific input sources (e.g. 'selection', 'output' variants) are recognized when the command requests input from the window.

Source

Thrown at kitty/boss.py:2532

            if input_data is None:
                type_of_input = end_kitten.type_of_input
                q = type_of_input.split('-') if type_of_input else []
                if not q:
                    data: bytes | None = None
                elif q[0] in ('text', 'history', 'ansi', 'screen'):
                    data = w.as_text(as_ansi='ansi' in q, add_history='history' in q, add_wrap_markers='screen' in q).encode('utf-8')
                elif type_of_input == 'selection':
                    sel = self.data_for_at(which='@selection', window=w)
                    data = sel.encode('utf-8') if sel else None
                elif q[0] in ('output', 'first_output', 'last_visited_output'):
                    which = {
                        'output': CommandOutput.last_run,
                        'first_output': CommandOutput.first_on_screen,
                        'last_visited_output': CommandOutput.last_visited,
                    }[q[0]]
                    data = w.cmd_output(which, as_ansi='ansi' in q, add_wrap_markers='screen' in q).encode('utf-8')
                else:
                    raise ValueError(f'Unknown type_of_input: {type_of_input}')
            else:
                data = input_data if isinstance(input_data, bytes) else input_data.encode('utf-8')
            copts = common_opts_as_dict(get_options())
            env = {
                'KITTY_COMMON_OPTS': json.dumps(copts),
                'KITTY_CHILD_PID': str(w.child.pid),
                'OVERLAID_WINDOW_LINES': str(w.screen.lines),
                'OVERLAID_WINDOW_COLS': str(w.screen.columns),
            }
            if is_wrapped:
                cmd = [kitten_exe(), kitten]
                env['KITTEN_RUNNING_AS_UI'] = '1'
                env['KITTY_CONFIG_DIRECTORY'] = config_dir
                if w is not None:
                    env['KITTY_BASIC_COLORS'] = json.dumps(w.screen.color_profile.basic_colors())
            else:
                cmd = [kitty_exe(), '+runpy', 'from kittens.runner import main; main()']
                env['PYTHONWARNINGS'] = 'ignore'

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Correct the spelling of type_of_input (check kitty @ launch --help)
  2. Upgrade kitty to the version that supports the desired input type
  3. Remove the option if no window input is needed

Example fix

# before
kitty @ launch --type-of-input=buf
# after
kitty @ launch --type-of-input=output
Defensive patterns

Strategy: validation

Validate before calling

VALID_INPUT_TYPES = {'none','selection','clipboard','primary','output','first_output','last_visited_output'}
if type_of_input not in VALID_INPUT_TYPES:
    raise ValueError(f'bad type_of_input: {type_of_input}')

Type guard

def is_valid_type_of_input(v: str) -> bool:
    return v in {'none','selection','clipboard','primary','output','first_output','last_visited_output'}

Try / catch

try:
    launch(...)
except ValueError as e:
    if 'Unknown type_of_input' in str(e):
        fix_and_retry()
    else:
        raise

Prevention

When it happens

Trigger: A launch/remote-control command specifying an unrecognized type_of_input for the child's stdin, e.g. `kitty @ launch --type-of-input=foo` or a map action using an input type kitty does not know.

Common situations: Typos in type_of_input, or using an input type introduced in a newer kitty version on an older kitty binary.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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