kovidgoyal/kitty · error

hyperlink option invalid: %s

Error message

hyperlink option invalid: %s

What it means

Inside --kitten hyperlink=..., one comma-separated token did not match any known flag (none, matching_lines, file_headers, context_lines).

Source

Thrown at kittens/hyperlinked_grep/main.go:156

			}
			for x := range strings.SplitSeq(v, ",") {
				switch x {
				case "none":
					kitten_opts.context_lines = false
					kitten_opts.file_headers = false
					kitten_opts.matching_lines = false
				case "all":
					kitten_opts.context_lines = true
					kitten_opts.file_headers = true
					kitten_opts.matching_lines = true
				case "matching_lines":
					kitten_opts.matching_lines = true
				case "file_headers":
					kitten_opts.file_headers = true
				case "context_lines":
					kitten_opts.context_lines = true
				default:
					return fmt.Errorf("hyperlink option invalid: %s", x)
				}
			}
		}
		return nil
	}

	handle_bool_option := func(key string) {
		switch key {
		case "no-context-separator":
			context_separator = ""
		case "no-filename":
			kitten_opts.with_filename = false
		case "with-filename":
			kitten_opts.with_filename = true
		case "heading":
			kitten_opts.heading = true
		case "no-heading":
			kitten_opts.heading = false

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use only the supported tokens: none, matching_lines, file_headers, context_lines
  2. Use underscores, not hyphens
  3. Combine multiple with commas: hyperlink=matching_lines,file_headers

Example fix

# before
--kitten hyperlink=file-headers
# after
--kitten hyperlink=file_headers
Defensive patterns

Strategy: validation

Validate before calling

valid := map[string]bool{"none":true,"matching_lines":true,"file_headers":true,"context_lines":true}
for _, t := range strings.Split(v, ",") { if !valid[t] { return fmt.Errorf("bad token %q", t) } }

Prevention

When it happens

Trigger: Passing --kitten hyperlink=matching-lines (hyphen instead of underscore) or an unknown token like 'all'.

Common situations: Guessing flag names; using hyphens where underscores are required; version where a flag doesn't exist yet.

Related errors


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