kovidgoyal/kitty · error

must specify --human-name when using a password

Error message

must specify --human-name when using a password

What it means

The clipboard kitten requires that any clipboard operation guarded by a password also identifies who is asking, via --human-name. When --password is non-empty but --human-name is empty, clipboard_main rejects the invocation before doing any clipboard I/O, because the remote client needs a name to display in the confirmation prompt.

Source

Thrown at kittens/clipboard/main.go:30

	"github.com/kovidgoyal/kitty/tools/cli"
)

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)
					}

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Add --human-name followed by a descriptive name, e.g. `kitten clipboard getfile --human-name my-script --password text:secret`
  2. If you do not actually need the password confirmation prompt, remove --password entirely
  3. For scripted use, pass the password via a file descriptor: `--password fd:3 3< pw.txt` together with --human-name

Example fix

# before
kitten clipboard get --password text:secret
# after
kitten clipboard get --human-name my-tool --password text:secret
Defensive patterns

Strategy: validation

Validate before calling

# before invoking kitten clipboard with a password, check both flags are set
[ -n "$PW" ] && [ -z "$HUMAN" ] && { echo '--human-name required'; exit 2; }

Prevention

When it happens

Trigger: Running `kitten clipboard --password ...` (e.g. `--password text:secret` or `--password fd:3`) without also passing --human-name. The check fires for every password form: text:, fd:, and file:.

Common situations: Scripts that add password protection to clipboard get/set operations but forget the human-readable requester name; copy-pasted command lines where the --human-name flag was dropped; automated wrappers built around kitten clipboard.

Related errors


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