kovidgoyal/kitty · error

invalid password: %#v no password type specified

Error message

invalid password: %#v no password type specified

What it means

The --password option expects a type-prefixed value of the form TYPE:value, where TYPE is one of text, fd, or file. clipboard_main uses strings.Cut on ':' and fails when no colon is present, meaning no password type was specified.

Source

Thrown at kittens/clipboard/main.go:34

func run_mime_loop(opts *Options, args []string) (err error) {
	cwd, err = os.Getwd()
	if err != nil {
		return err
	}
	if opts.GetClipboard {
		return run_get_loop(opts, args)
	}
	return run_set_loop(opts, args)
}

func clipboard_main(cmd *cli.Command, opts *Options, args []string) (rc int, err error) {
	if opts.Password != "" {
		if opts.HumanName == "" {
			return 1, fmt.Errorf("must specify --human-name when using a password")
		}
		ptype, val, found := strings.Cut(opts.Password, ":")
		if !found {
			return 1, fmt.Errorf("invalid password: %#v no password type specified", opts.Password)
		}
		switch ptype {
		case "text":
			opts.Password = val
		case "fd":
			if fd, err := strconv.Atoi(val); err == nil {
				if f := os.NewFile(uintptr(fd), "password-fd"); f == nil {
					return 1, fmt.Errorf("invalid file descriptor: %d", fd)
				} else {
					data, err := io.ReadAll(f)
					f.Close()
					if err != nil {
						return 1, fmt.Errorf("failed to read from file descriptor: %d with error: %w", fd, err)
					}
					opts.Password = strings.TrimRightFunc(string(data), unicode.IsSpace)
				}

			} else {

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Prefix the value with a type: `--password text:secret`, `--password fd:3`, or `--password file:/path/to/pw`
  2. For secrets that may contain colons, use the file: or fd: form so the first colon is not ambiguous
  3. Remember --human-name is also required whenever --password is used

Example fix

# before
kitten clipboard get --human-name me --password hunter2
# after
kitten clipboard get --human-name me --password text:hunter2
Defensive patterns

Strategy: validation

Validate before calling

case "$PW" in text:*|fd:*|file:*) ;; *) echo "--password must be type:value"; exit 2;; esac

Prevention

When it happens

Trigger: Passing `--password secret` or `--password 1234` — anything without a `type:value` colon separator. Valid forms are `text:...`, `fd:<number>`, and `file:<path>`.

Common situations: Users assuming --password takes the raw secret directly; migration from tools that accept bare passwords; shell quoting mistakes that swallow the colon.

Related errors


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