kovidgoyal/kitty · error

No key specified after flag %s

Error message

No key specified after flag %s

What it means

ParseMap parses a map directive string; while consuming leading --flags it splits on the first space. If no space remains after the flag, there is no key spec left, so it errors naming the flag.

Source

Thrown at tools/config/utils.go:276

func validateAllowFallback(value string) error {
	if value == "" || value == "none" {
		return nil
	}
	for part := range strings.SplitSeq(value, ",") {
		part = strings.TrimSpace(part)
		if part != "shifted" && part != "ascii" {
			return fmt.Errorf("Invalid allow-fallback value %#v, allowed values: shifted, ascii, none", part)
		}
	}
	return nil
}

func ParseMap(val string) (*KeyAction, error) {
	allow_fallback := "shifted"
	for strings.HasPrefix(val, "--") {
		flag, rest, found := strings.Cut(val, " ")
		if !found {
			return nil, fmt.Errorf("No key specified after flag %s", flag)
		}
		rest = strings.TrimSpace(rest)
		if name, value, ok := strings.Cut(flag, "="); ok {
			// --flag=value form
			name = strings.ReplaceAll(name[2:], "-", "_")
			switch name {
			case "allow_fallback":
				if err := validateAllowFallback(value); err != nil {
					return nil, err
				}
				if value == "none" {
					allow_fallback = ""
				} else {
					allow_fallback = value
				}
			default:
				return nil, fmt.Errorf("Unknown map option: %s", flag)
			}

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Append the key spec and action after the flag: `--allow-fallback=none ctrl+a 1`
  2. Verify the whole map line wasn't cut off by a missing space

Example fix

# before
map --allow-fallback=none
# after
map --allow-fallback=none ctrl+a 1
Defensive patterns

Strategy: validation

Validate before calling

if !strings.Contains(val, " ") { return fmt.Errorf("map directive lacks key/action after flags: %q", val) }

Prevention

When it happens

Trigger: A map value consisting only of flags, e.g. `--allow-fallback=none` with no trailing key/action, or ending in a flag with nothing after it.

Common situations: Truncated map lines after editing, or a flag consuming the rest of the line because the key/action was accidentally deleted.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/501066c51988ac75. Report an issue: GitHub.