kovidgoyal/kitty · error
must specify the key
Error message
must specify the key
What it means
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.
Source
Thrown at kittens/desktop_ui/main.go:149
case "high":
v = dbus.MakeVariant(uint32(1))
default:
return 1, fmt.Errorf("%s is not a valid contrast value", args[0])
}
err = set_variant_setting(PORTAL_APPEARANCE_NAMESPACE, PORTAL_CONTRAST_KEY, v, false)
return utils.IfElse(err == nil, 0, 1), err
},
})
st := parent.AddSubCommand(&cli.Command{
Name: "set-setting",
ShortDescription: "Change an arbitrary setting",
Usage: " key [value]",
HelpText: "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.",
Run: func(cmd *cli.Command, args []string) (rc int, err error) {
val := ""
if len(args) < 1 {
cmd.ShowHelp()
return 1, fmt.Errorf("must specify the key")
}
if len(args) > 1 {
val = args[1]
}
opts := SetOptions{}
if err = cmd.GetOptionValues(&opts); err == nil {
err = set_setting(args[0], val, &opts)
}
return utils.IfElse(err == nil, 0, 1), err
},
})
st.Add(cli.OptionSpec{
Name: "--namespace -n",
Help: "The namespace in which to change the setting.",
Default: PORTAL_APPEARANCE_NAMESPACE,
})
st.Add(cli.OptionSpec{
Name: "--data-type",View on GitHub (pinned to 6d5d0c4406)
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
Example fix
# before kitten desktop-ui set "" # after kitten desktop-ui set org.freedesktop.appearance color-scheme 1
Defensive patterns
Strategy: validation
Validate before calling
if key == "" {
return errors.New("key must not be empty")
} Prevention
- Check shell variables are non-empty before building the command
When it happens
Trigger: Running `kitten desktop-ui set` with no arguments at all.
Common situations: Scripts passing an empty key variable; users exploring the command without reading its usage line `set key [value]`.
Related errors
- must specify the new contrast value
- no arguments allowed
- Unknown extra argument(s) supplied to {command.name}
- %s is not a valid contrast value
- Unknown --kitten option: %s
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/2cbb86a9834f6434.
Report an issue: GitHub.