{"record":{"id":"4023b9b74377822d","repo":"kovidgoyal/kitty","slug":"must-specify-the-new-contrast-value","errorCode":null,"errorMessage":"must specify the new contrast value","messagePattern":"must specify the new contrast value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/desktop_ui/main.go","lineNumber":124,"sourceCode":"\t\t\tif len(args) != 1 {\n\t\t\t\tcmd.ShowHelp()\n\t\t\t\treturn 1, fmt.Errorf(\"must specify the new accent color value\")\n\t\t\t}\n\t\t\tvar v dbus.Variant\n\t\t\tif v, err = to_color(args[0]); err == nil {\n\t\t\t\terr = set_variant_setting(PORTAL_APPEARANCE_NAMESPACE, PORTAL_ACCENT_COLOR_KEY, v, false)\n\t\t\t}\n\t\t\treturn utils.IfElse(err == nil, 0, 1), err\n\t\t},\n\t})\n\tparent.AddSubCommand(&cli.Command{\n\t\tName:             \"set-contrast\",\n\t\tShortDescription: \"Change the contrast. Can be high or normal.\",\n\t\tUsage:            \" high|normal\",\n\t\tRun: func(cmd *cli.Command, args []string) (rc int, err error) {\n\t\t\tif len(args) != 1 {\n\t\t\t\tcmd.ShowHelp()\n\t\t\t\treturn 1, fmt.Errorf(\"must specify the new contrast value\")\n\t\t\t}\n\n\t\t\tvar v dbus.Variant\n\t\t\tswitch args[0] {\n\t\t\tcase \"normal\":\n\t\t\t\tv = dbus.MakeVariant(uint32(0))\n\t\t\tcase \"high\":\n\t\t\t\tv = dbus.MakeVariant(uint32(1))\n\t\t\tdefault:\n\t\t\t\treturn 1, fmt.Errorf(\"%s is not a valid contrast value\", args[0])\n\t\t\t}\n\t\t\terr = set_variant_setting(PORTAL_APPEARANCE_NAMESPACE, PORTAL_CONTRAST_KEY, v, false)\n\t\t\treturn utils.IfElse(err == nil, 0, 1), err\n\t\t},\n\t})\n\tst := parent.AddSubCommand(&cli.Command{\n\t\tName:             \"set-setting\",\n\t\tShortDescription: \"Change an arbitrary setting\",","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/desktop_ui/main.go#L106-L142","documentation":"Thrown by the `set-contrast` subcommand of the desktop-ui kitten when it is invoked without exactly one argument. The command expects either `normal` or `high` as the contrast value, so any other argument count aborts with this error after printing help.","triggerScenarios":"Running `kitten desktop-ui set-contrast` with zero arguments or with more than one argument (e.g. `set-contrast high extra`).","commonSituations":"Scripts that build the command dynamically and pass an empty/unset variable as the contrast value; users forgetting the required value.","solutions":["Run `kitten desktop-ui set-contrast high` or `kitten desktop_ui set-contrast normal` with exactly one argument","Check your shell variable expansion (e.g. unset `$CONTRAST`) before invoking the command"],"exampleFix":"# before\nkitten desktop-ui set-contrast\n# after\nkitten desktop-ui set-contrast high","handlingStrategy":"validation","validationCode":"if len(args) != 1 || (args[0] != \"normal\" && args[0] != \"high\") {\n    fmt.Fprintln(os.Stderr, \"usage: set-contrast high|normal\")\n    os.Exit(1)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate argument count and value in wrappers/scripts before shelling out"],"tags":["cli","desktop-ui","kitty","argument-validation"],"backgroundTag":"cli-missing-argument","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}