kovidgoyal/kitty · error · ValueError

Passwords are not allowed to start with hyphens, ignoring th

Error message

Passwords are not allowed to start with hyphens, ignoring this password

What it means

remote_control_password yields passwords from kitty.conf; each value is shell-split via to_cmdline and if the first component starts with '-', this error is raised. The restriction reserves leading hyphens so future --option flags can be added to the directive.

Source

Thrown at kitty/options/utils.py:974

        return ()
    from glob import glob

    x = resolve_abs_or_config_path(x, None)
    return tuple(x for x in sorted(glob(x)) if x.rpartition('.')[-1].lower() in ('jpeg', 'jpg', 'png', 'webp', 'tif', 'tiff', 'bmp', 'gif')) or (x,)


def filter_notification(val: str, current_val: dict[str, str]) -> Iterator[tuple[str, str]]:
    yield val, ''


def remote_control_password(val: str, current_val: dict[str, str]) -> Iterator[tuple[str, Sequence[str]]]:
    val = val.strip()
    if val:
        parts = to_cmdline(val, expand=False)
        if parts[0].startswith('-'):
            # this is done so in the future we can add --options to the cmd
            # line of remote_control_password
            raise ValueError('Passwords are not allowed to start with hyphens, ignoring this password')
        if len(parts) == 1:
            yield parts[0], ()
        else:
            yield parts[0], tuple(parts[1:])


def clipboard_control(x: str) -> tuple[str, ...]:
    return tuple(x.lower().split())


def custom_shaders(x: str) -> tuple[str, ...]:
    return tuple(shlex_split(x)) if x else ()


def allow_hyperlinks(x: str) -> int:
    if x == 'ask':
        return 0b11
    return 1 if to_bool(x) else 0

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Change the password to not start with a hyphen
  2. Regenerate the password or prefix it with an allowed non-hyphen character

Example fix

# before
remote_control_password -abc123
# after
remote_control_password abc123
Defensive patterns

Strategy: validation

Validate before calling

def valid_rc_password(v: str) -> bool:
    return not v.strip().split()[0].startswith('-')

Prevention

When it happens

Trigger: remote_control_password -mysecret or any password beginning with '-' in kitty.conf.

Common situations: Auto-generated passwords starting with a dash; users trying to pass flag-like strings.

Related errors


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