kovidgoyal/kitty · warning
Usage: __atexit__
Error message
Usage: __atexit__
What it means
The atexit tool was invoked with unexpected command-line arguments: its CLI wrapper recognized no valid subcommand/flag combination, so it bails with the usage message 'Usage: __atexit__'. It is a pure argument-validation error — nothing ran yet.
Source
Thrown at tools/cmd/atexit/main.go:95
}
return
}
func EntryPoint(root *cli.Command) {
root.AddSubCommand(&cli.Command{
Name: "__atexit__",
Hidden: true,
OnlyArgsAllowed: true,
Run: func(cmd *cli.Command, args []string) (rc int, err error) {
if len(args) != 0 {
if args[0] == "test" {
rc = 0
if err = do_test(); err != nil {
rc = 1
}
return
}
return 1, fmt.Errorf("Usage: __atexit__")
}
return main()
},
})
}
View on GitHub (pinned to 6d5d0c4406)
Solutions
- Run the tool with no arguments or --help to list valid subcommands
- Fix the typo/order of the first argument to a registered subcommand
- If a script breaks after an upgrade, diff the tool's help output against what the script passes
Example fix
# before __atexit__ testt # after __atexit__ test
Defensive patterns
Strategy: validation
Validate before calling
// Validate argv before invoking the tool
valid := map[string]bool{"test": true /* other real subcommands */}
if len(os.Args) > 1 && !valid[os.Args[1]] {
fmt.Fprintln(os.Stderr, "Usage: __atexit__"); os.Exit(2)
} Try / catch
// Shell wrapper
if ! __atexit__ "$cmd" 2>/dev/null; then
echo "unknown subcommand: $cmd" >&2; __atexit__ --help
fi Prevention
- Script against --help output or a pinned version
- Add a smoke test that exercises each scripted subcommand after upgrades
When it happens
Trigger: Running the atexit binary with arguments that don't match any registered subcommand (e.g. a typo'd or unsupported first argument), so argument parsing falls through to the usage-error return in main.go:95.
Common situations: Typos in subcommand names, passing flags before/without the subcommand, scripts written against an older version whose subcommands were renamed, or copy-pasting an invocation from docs of a different tool.
Related errors
- Usage: kitty +runpy "some python code"
- usage: kitty +launch script.py [arguments to be passed to sc
- Unknown extra argument(s) supplied to {command.name}
- must specify the new contrast value
- must specify the key
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/f2d5e73fdb0714d6.
Report an issue: GitHub.