{"record":{"id":"c865fefbc98d4ee5","repo":"kovidgoyal/kitty","slug":"cannot-use-human-name-or-password-in-filter-mo","errorCode":null,"errorMessage":"cannot use --human-name or --password in filter mode","messagePattern":"cannot use --human-name or --password in filter mode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/clipboard/main.go","lineNumber":67,"sourceCode":"\t\t\t\t\topts.Password = strings.TrimRightFunc(string(data), unicode.IsSpace)\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\treturn 1, fmt.Errorf(\"not a valid file descriptor number: %#v\", val)\n\t\t\t}\n\t\tcase \"file\":\n\t\t\tif data, err := os.ReadFile(val); err == nil {\n\t\t\t\topts.Password = strings.TrimRightFunc(string(data), unicode.IsSpace)\n\t\t\t} else {\n\t\t\t\treturn 1, fmt.Errorf(\"failed to read from file: %#v with error: %w\", val, err)\n\t\t\t}\n\t\t}\n\t}\n\tif len(args) > 0 {\n\t\treturn 0, run_mime_loop(opts, args)\n\t}\n\tif opts.Password != \"\" || opts.HumanName != \"\" {\n\t\treturn 1, fmt.Errorf(\"cannot use --human-name or --password in filter mode\")\n\t}\n\treturn 0, run_plain_text_loop(opts)\n}\n\nfunc EntryPoint(parent *cli.Command) {\n\tcreate_cmd(parent, clipboard_main)\n}\n","sourceCodeStart":49,"sourceCodeEnd":75,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/clipboard/main.go#L49-L75","documentation":"In filter mode (kitten clipboard with no file arguments, which pipes stdin through the clipboard via run_plain_text_loop), no authentication context is allowed. If --password or --human-name was supplied anyway, clipboard_main rejects the combination before starting the loop.","triggerScenarios":"Running `kitten clipboard --human-name x` or `kitten clipboard --password text:y` (or both) with zero positional file arguments — that is, plain filter mode reading stdin.","commonSituations":"Users adding password flags to a pipeline like `echo hi | kitten clipboard --password text:pw` expecting password-protected copying; flag-order confusion where get/set subcommands were omitted.","solutions":["For simple piping, drop --password/--human-name: `echo hi | kitten clipboard`","To use passwords, run an explicit get/getfile command with file arguments, e.g. `kitten clipboard get --human-name me --password text:pw dest.png`","Review kitten clipboard --help to confirm which mode your flags apply to"],"exampleFix":"# before\necho hi | kitten clipboard --human-name me --password text:pw\n# after\necho hi | kitten clipboard","handlingStrategy":"validation","validationCode":"# filter mode = no positional args; forbid auth flags then\n[ $# -eq 0 ] && { [ -n \"$PW$HUMAN\" ] && { echo 'no --password/--human-name in filter mode'; exit 2; }; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Branch your wrapper: filter mode vs get/getfile mode, and only add auth flags in the latter"],"tags":["kitty","clipboard","cli-arguments","mode-conflict"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}