kovidgoyal/kitty · warning · ValueError

layout_action bias must contain at least one number between

Error message

layout_action bias must contain at least one number between 10 and 90

What it means

The 'bias' layout action on the tall layouts requires at least one numeric argument (a bias percentage). The layout code raises this immediately when layout_action('bias', ...) is called with zero arguments, before any parsing of the value string.

Source

Thrown at kitty/layout/tall.py:278

            if self.layout_opts.full_size > 1:
                self.layout_opts.full_size -= 1
                self.main_bias = list(self.layout_opts.build_bias_list())
                return True
        if action_name == 'mirror':
            action = (args or ('toggle',))[0]
            ok = False
            if action == 'toggle':
                self.layout_opts.mirrored = not self.layout_opts.mirrored
                ok = True
            else:
                new_val = to_bool(action)
                if new_val != self.layout_opts.mirrored:
                    self.layout_opts.mirrored = new_val
                    ok = True
            return ok
        if action_name == 'bias':
            if len(args) == 0:
                raise ValueError('layout_action bias must contain at least one number between 10 and 90')
            biases = args[0].split()
            if len(biases) == 1:
                biases.append('50')
            try:
                i = biases.index(str(self.layout_opts.bias)) + 1
            except ValueError:
                i = 0
            try:
                self.layout_opts.bias = int(biases[i % len(biases)])
                self.remove_all_biases()
                return True
            except Exception:
                return False
        return None

    def minimal_borders(self, windows: WindowList) -> Iterator[BorderLine]:
        num = windows.num_groups
        if num < 2 or not lgd.draw_minimal_borders:

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Supply a bias value: layout_action bias 70 (10–90)
  2. If only one bias is given a default of 50 is appended, so passing one number is enough
  3. Fix the key mapping to include the numeric argument

Example fix

# before
kitty @ kitten layout_action bias
# after
kitty @ kitten layout_action bias 70
Defensive patterns

Strategy: validation

Validate before calling

if action == 'bias' and not args:
    args = ['50']  # or reject before calling
layout_action('bias', args)

Try / catch

try:
    boss.layout_action('bias', args)
except ValueError as e:
    show_user_message(f'bias needs a number 10-90: {e}')

Prevention

When it happens

Trigger: Calling layout_action('bias') with an empty args list, e.g. via remote control: kitten @ launch --type=action ... or kitty @ kitten layout_action bias with no value, or a key mapping mapped to 'layout_action bias' with no parameter.

Common situations: User maps :map ctrl+b layout_action bias but forgets the numeric argument; a remote-control script iterates over layout actions and passes an empty list.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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