{"record":{"id":"2cbb86a9834f6434","repo":"kovidgoyal/kitty","slug":"must-specify-the-key","errorCode":null,"errorMessage":"must specify the key","messagePattern":"must specify the key","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/desktop_ui/main.go","lineNumber":149,"sourceCode":"\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\",\n\t\tUsage:            \" key [value]\",\n\t\tHelpText:         \"Set an arbitrary setting. If you want to set the color-scheme use the dedicated command for it. Use this command with care as it does no validation for the type of value. The syntax for specifying values is described at: :link:`the glib docs <https://docs.gtk.org/glib/gvariant-text-format.html>`. Leaving out the value or specifying an empty value, will delete the setting.\",\n\t\tRun: func(cmd *cli.Command, args []string) (rc int, err error) {\n\t\t\tval := \"\"\n\t\t\tif len(args) < 1 {\n\t\t\t\tcmd.ShowHelp()\n\t\t\t\treturn 1, fmt.Errorf(\"must specify the key\")\n\t\t\t}\n\t\t\tif len(args) > 1 {\n\t\t\t\tval = args[1]\n\t\t\t}\n\t\t\topts := SetOptions{}\n\t\t\tif err = cmd.GetOptionValues(&opts); err == nil {\n\t\t\t\terr = set_setting(args[0], val, &opts)\n\t\t\t}\n\t\t\treturn utils.IfElse(err == nil, 0, 1), err\n\t\t},\n\t})\n\tst.Add(cli.OptionSpec{\n\t\tName:    \"--namespace -n\",\n\t\tHelp:    \"The namespace in which to change the setting.\",\n\t\tDefault: PORTAL_APPEARANCE_NAMESPACE,\n\t})\n\tst.Add(cli.OptionSpec{\n\t\tName: \"--data-type\",","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/desktop_ui/main.go#L131-L167","documentation":"The `set` subcommand requires at least one argument: the settings key to set (or delete, when no value is given). Invoking it with no arguments shows help and returns this error.","triggerScenarios":"Running `kitten desktop-ui set` with no arguments at all.","commonSituations":"Scripts passing an empty key variable; users exploring the command without reading its usage line `set key [value]`.","solutions":["Provide at least a key: `kitten desktop-ui set org.example.key value`","Omit the value only when you intend to delete the setting","Verify shell variables used for the key are non-empty"],"exampleFix":"# before\nkitten desktop-ui set \"\"\n# after\nkitten desktop-ui set org.freedesktop.appearance color-scheme 1","handlingStrategy":"validation","validationCode":"if key == \"\" {\n    return errors.New(\"key must not be empty\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check shell variables are non-empty before building the command"],"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"}