{"record":{"id":"c05f77c1ea8fad20","repo":"kovidgoyal/kitty","slug":"must-specify-human-name-when-using-a-password","errorCode":null,"errorMessage":"must specify --human-name when using a password","messagePattern":"must specify --human-name when using a password","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/clipboard/main.go","lineNumber":30,"sourceCode":"\n\t\"github.com/kovidgoyal/kitty/tools/cli\"\n)\n\nfunc run_mime_loop(opts *Options, args []string) (err error) {\n\tcwd, err = os.Getwd()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif opts.GetClipboard {\n\t\treturn run_get_loop(opts, args)\n\t}\n\treturn run_set_loop(opts, args)\n}\n\nfunc clipboard_main(cmd *cli.Command, opts *Options, args []string) (rc int, err error) {\n\tif opts.Password != \"\" {\n\t\tif opts.HumanName == \"\" {\n\t\t\treturn 1, fmt.Errorf(\"must specify --human-name when using a password\")\n\t\t}\n\t\tptype, val, found := strings.Cut(opts.Password, \":\")\n\t\tif !found {\n\t\t\treturn 1, fmt.Errorf(\"invalid password: %#v no password type specified\", opts.Password)\n\t\t}\n\t\tswitch ptype {\n\t\tcase \"text\":\n\t\t\topts.Password = val\n\t\tcase \"fd\":\n\t\t\tif fd, err := strconv.Atoi(val); err == nil {\n\t\t\t\tif f := os.NewFile(uintptr(fd), \"password-fd\"); f == nil {\n\t\t\t\t\treturn 1, fmt.Errorf(\"invalid file descriptor: %d\", fd)\n\t\t\t\t} else {\n\t\t\t\t\tdata, err := io.ReadAll(f)\n\t\t\t\t\tf.Close()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn 1, fmt.Errorf(\"failed to read from file descriptor: %d with error: %w\", fd, err)\n\t\t\t\t\t}","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/clipboard/main.go#L12-L48","documentation":"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.","triggerScenarios":"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:.","commonSituations":"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.","solutions":["Add --human-name followed by a descriptive name, e.g. `kitten clipboard getfile --human-name my-script --password text:secret`","If you do not actually need the password confirmation prompt, remove --password entirely","For scripted use, pass the password via a file descriptor: `--password fd:3 3< pw.txt` together with --human-name"],"exampleFix":"# before\nkitten clipboard get --password text:secret\n# after\nkitten clipboard get --human-name my-tool --password text:secret","handlingStrategy":"validation","validationCode":"# before invoking kitten clipboard with a password, check both flags are set\n[ -n \"$PW\" ] && [ -z \"$HUMAN\" ] && { echo '--human-name required'; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair --password with --human-name in wrappers/scripts","Centralize kitten clipboard invocation in one helper function so flag combos are validated once","Add a smoke test for your clipboard command line in CI"],"tags":["kitty","clipboard","cli-arguments","password"],"backgroundTag":"missing-required-cli-argument","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}