kovidgoyal/kitty · error · ValueError

{path} is not a supported shell

Error message

{path} is not a supported shell

What it means

serialize_env encodes a dict of environment variables into shell syntax for a supported shell (zsh/bash/fish). It resolves the shell by path via get_supported_shell_name; if the path doesn't match a known supported shell, it raises this ValueError because no serializer exists for that shell.

Source

Thrown at kitty/shell_integration.py:208

def get_supported_shell_name(path: str) -> str | None:
    name = os.path.basename(path)
    if name.lower().endswith('.exe'):
        name = name.rpartition('.')[0]
    if name.startswith('-'):
        name = name[1:]
    return name if name in ENV_MODIFIERS else None


def shell_integration_allows_rc_modification(opts: Options) -> bool:
    return not (opts.shell_integration & {'disabled', 'no-rc'})


def serialize_env(path: str, env: dict[str, str]) -> str:
    if not env:
        return ''
    name = get_supported_shell_name(path)
    if not name:
        raise ValueError(f'{path} is not a supported shell')
    return ENV_SERIALIZERS[name](env)


@run_once
def unsafe_pat() -> re.Pattern[str]:
    return re.compile(r'[^\w@%+=:,./-]', re.ASCII)


def join(path: str, cmd: Iterable[str]) -> str:
    name = get_supported_shell_name(path)
    _find_unsafe = unsafe_pat().search
    if not name:
        raise ValueError(f'{path} is not a supported shell')
    q = QUOTERES.get(name, as_str_literal)

    def quote(x: str) -> str:
        return x if _find_unsafe(x) is None else q(x)

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Set the shell to a supported one: zsh, bash, or fish (e.g. shell /bin/bash in kitty.conf)
  2. If using a wrapper, point kitty directly at the real supported shell binary
  3. Catch the ValueError and fall back to not injecting the env via shell-integration serialization

Example fix

# before
kitty.conf: shell /usr/bin/tcsh
# after
kitty.conf: shell /bin/bash
Defensive patterns

Strategy: fallback

Validate before calling

from kitty.shell_integration import get_supported_shell_name

def can_serialize(shell_path: str) -> bool:
    return bool(get_supported_shell_name(shell_path))

Try / catch

try:
    blob = serialize_env(shell_path, env)
except ValueError:
    blob = ''  # skip env injection for unsupported shells
    log_warning(f'env not serialized for {shell_path}')

Prevention

When it happens

Trigger: Calling serialize_env('/usr/bin/fish'...) is fine, but calling it with '/usr/bin/tcsh', '/bin/dash', a custom shell path, or a path whose basename isn't in the supported set raises this. Typically reached via clone_and_launch / shell integration env propagation.

Common situations: User's SHELL or kitty's shell config points to an unsupported shell (nushell, elvish, xonsh, tcsh); distro-specific shell paths; a wrapper script as the shell.

Related errors


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