{"record":{"id":"f8bb1bed5108bcfc","repo":"kovidgoyal/kitty","slug":"this-must-be-run-as-kitten-themes","errorCode":null,"errorMessage":"This must be run as kitten themes","messagePattern":"This must be run as kitten themes","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"kittens/themes/main.py","lineNumber":112,"sourceCode":"--dump-theme\ntype=bool-set\ndefault=false\nWhen running non-interactively, dump the specified theme to STDOUT\ninstead of changing kitty.conf.\n\n\n--config-file-name\ndefault=kitty.conf\nThe name or path to the config file to edit. Relative paths are interpreted\nwith respect to the kitty config directory. By default the kitty config file,\nkitty.conf is edited. This is most useful if you add :code:`include themes.conf`\nto your kitty.conf and then have the kitten operate only on :file:`themes.conf`,\nallowing :code:`kitty.conf` to remain unchanged.\n\"\"\".format\n\n\ndef main(args: list[str]) -> None:\n    raise SystemExit('This must be run as kitten themes')\n\n\nif __name__ == '__main__':\n    main(sys.argv)\nelif __name__ == '__doc__':\n    cd = sys.cli_docs  # type: ignore\n    cd['usage'] = usage\n    cd['options'] = OPTIONS\n    cd['help_text'] = help_text\n    cd['short_desc'] = 'Manage kitty color schemes easily'\n    cd['args_completion'] = CompletionSpec.from_string('type:special group:complete_themes')\nelif __name__ == '__conf__':\n    sys.options_definition = definition  # type: ignore\n","sourceCodeStart":94,"sourceCodeEnd":126,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/themes/main.py#L94-L126","documentation":"The themes kitten's main() is a deliberate stub: it always raises SystemExit('This must be run as kitten themes'). The real functionality is provided by kitty's kitten runner (the '__doc__'/cli_docs machinery shown in the source); executing the module directly as __main__ can only reach the stub.","triggerScenarios":"Running `python kittens/themes/main.py` directly, or importing kittens/themes/main.py and calling main(args). Works correctly only when launched via `kitten themes` inside kitty.","commonSituations":"Source-diving and executing the file with python/IDE run; scripts calling main() programmatically; attempting to use the theme browser outside kitty (e.g. in gnome-terminal), where it cannot work anyway.","solutions":["Run `kitten themes` from inside a kitty window (or map a key: map f1 launch --type=overlay kitten themes).","For programmatic theme manipulation, edit the theme files in ~/.config/kitty/themes or use kitty's remote-control/set-colors API instead of the stub main().","In tests, import and exercise the theme-loading helpers, not main()."],"exampleFix":"# before\npython kittens/themes/main.py  # SystemExit: This must be run as kitten themes\n\n# after\nkitten themes","handlingStrategy":"validation","validationCode":"import os\n\ndef can_run_kitten() -> bool:\n    return bool(os.environ.get('KITTY_WINDOW_ID')) and bool(shutil.which('kitten'))\n\nif not can_run_kitten():\n    raise SystemExit('themes kitten requires kitty; run: kitten themes')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Launch via `kitten themes` or a kitty.conf mapping; never execute main.py directly.","For theme switching outside kitty, write themes.conf / use remote control instead.","In CI, skip tests that require an interactive kitty window."],"tags":["kitty","themes","kitten","system-exit","standalone-execution"],"backgroundTag":"must-run-via-parent-runner","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}