kovidgoyal/kitty · error

Extra command line arguments present: %s

Error message

Extra command line arguments present: %s

What it means

The hints kitten got extra positional command-line arguments, which it does not accept (its only input is STDIN) unless --customize-processing is set or --type linenum is used.

Source

Thrown at kittens/hints/main.go:123

				ans = "bright-black"
			}
		}
	}
	return
}

func main(_ *cli.Command, o *Options, args []string) (rc int, err error) {
	o.HintsTextColor = hints_text_color(o.HintsTextColor)
	output := tui.KittenOutputSerializer()
	if tty.IsTerminal(os.Stdin.Fd()) {
		return 1, fmt.Errorf("You must pass the text to be hinted on STDIN")
	}
	stdin, err := io.ReadAll(os.Stdin)
	if err != nil {
		return 1, fmt.Errorf("Failed to read from STDIN with error: %w", err)
	}
	if len(args) > 0 && o.CustomizeProcessing == "" && o.Type != "linenum" {
		return 1, fmt.Errorf("Extra command line arguments present: %s", strings.Join(args, " "))
	}
	input_text := parse_input(utils.UnsafeBytesToString(stdin))
	text, all_marks, index_map, err := find_marks(input_text, o, os.Args[2:]...)
	if err != nil {
		return 1, err
	}

	result := Result{
		Programs: o.Program, Multiple_joiner: o.MultipleJoiner, Customize_processing: o.CustomizeProcessing, Type: o.Type,
		Extra_cli_args: args, Linenum_action: o.LinenumAction,
	}
	result.Cwd, _ = os.Getwd()
	alphabet := o.Alphabet
	if alphabet == "" {
		alphabet = DEFAULT_HINT_ALPHABET
	}
	ignore_mark_indices := utils.NewSet[int](8)
	window_title := o.WindowTitle

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Remove positional arguments and pipe the text instead: cat file.txt | kitten hints --type url
  2. For linenum mode use --type linenum where args are allowed
  3. If you need custom arg handling, write a --customize-processing script

Example fix

# before
kitten hints --type url file.txt
# after
cat file.txt | kitten hints --type url
Defensive patterns

Strategy: validation

Validate before calling

if len(args) > 0 && o.CustomizeProcessing == "" && o.Type != "linenum" {
	return fmt.Errorf("unexpected args: %v", args)
}

Prevention

When it happens

Trigger: main() sees len(args) > 0 while o.CustomizeProcessing == "" and o.Type != "linenum" — e.g. 'kitten hints --type url file.txt' passes file.txt as a stray positional.

Common situations: Assuming hints reads a filename argument like grep; leftover shell-expanded glob producing extra args.

Related errors


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