{"record":{"id":"b86a7982a932af14","repo":"kovidgoyal/kitty","slug":"extra-command-line-arguments-present-s","errorCode":null,"errorMessage":"Extra command line arguments present: %s","messagePattern":"Extra command line arguments present: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/hints/main.go","lineNumber":123,"sourceCode":"\t\t\t\tans = \"bright-black\"\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}\n\nfunc main(_ *cli.Command, o *Options, args []string) (rc int, err error) {\n\to.HintsTextColor = hints_text_color(o.HintsTextColor)\n\toutput := tui.KittenOutputSerializer()\n\tif tty.IsTerminal(os.Stdin.Fd()) {\n\t\treturn 1, fmt.Errorf(\"You must pass the text to be hinted on STDIN\")\n\t}\n\tstdin, err := io.ReadAll(os.Stdin)\n\tif err != nil {\n\t\treturn 1, fmt.Errorf(\"Failed to read from STDIN with error: %w\", err)\n\t}\n\tif len(args) > 0 && o.CustomizeProcessing == \"\" && o.Type != \"linenum\" {\n\t\treturn 1, fmt.Errorf(\"Extra command line arguments present: %s\", strings.Join(args, \" \"))\n\t}\n\tinput_text := parse_input(utils.UnsafeBytesToString(stdin))\n\ttext, all_marks, index_map, err := find_marks(input_text, o, os.Args[2:]...)\n\tif err != nil {\n\t\treturn 1, err\n\t}\n\n\tresult := Result{\n\t\tPrograms: o.Program, Multiple_joiner: o.MultipleJoiner, Customize_processing: o.CustomizeProcessing, Type: o.Type,\n\t\tExtra_cli_args: args, Linenum_action: o.LinenumAction,\n\t}\n\tresult.Cwd, _ = os.Getwd()\n\talphabet := o.Alphabet\n\tif alphabet == \"\" {\n\t\talphabet = DEFAULT_HINT_ALPHABET\n\t}\n\tignore_mark_indices := utils.NewSet[int](8)\n\twindow_title := o.WindowTitle","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/hints/main.go#L105-L141","documentation":"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.","triggerScenarios":"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.","commonSituations":"Assuming hints reads a filename argument like grep; leftover shell-expanded glob producing extra args.","solutions":["Remove positional arguments and pipe the text instead: cat file.txt | kitten hints --type url","For linenum mode use --type linenum where args are allowed","If you need custom arg handling, write a --customize-processing script"],"exampleFix":"# before\nkitten hints --type url file.txt\n# after\ncat file.txt | kitten hints --type url","handlingStrategy":"validation","validationCode":"if len(args) > 0 && o.CustomizeProcessing == \"\" && o.Type != \"linenum\" {\n\treturn fmt.Errorf(\"unexpected args: %v\", args)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pipe input instead of passing filenames","Use --type linenum when positional args are needed"],"tags":["hints","cli-usage","argument-validation"],"backgroundTag":"unexpected-cli-argument","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}