{"record":{"id":"cb8906e8e03ab95c","repo":"kovidgoyal/kitty","slug":"invalid-password-v-no-password-type-specified","errorCode":null,"errorMessage":"invalid password: %#v no password type specified","messagePattern":"invalid password: %#v no password type specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/clipboard/main.go","lineNumber":34,"sourceCode":"func 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}\n\t\t\t\t\topts.Password = strings.TrimRightFunc(string(data), unicode.IsSpace)\n\t\t\t\t}\n\n\t\t\t} else {","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/clipboard/main.go#L16-L52","documentation":"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.","triggerScenarios":"Passing `--password secret` or `--password 1234` — anything without a `type:value` colon separator. Valid forms are `text:...`, `fd:<number>`, and `file:<path>`.","commonSituations":"Users assuming --password takes the raw secret directly; migration from tools that accept bare passwords; shell quoting mistakes that swallow the colon.","solutions":["Prefix the value with a type: `--password text:secret`, `--password fd:3`, or `--password file:/path/to/pw`","For secrets that may contain colons, use the file: or fd: form so the first colon is not ambiguous","Remember --human-name is also required whenever --password is used"],"exampleFix":"# before\nkitten clipboard get --human-name me --password hunter2\n# after\nkitten clipboard get --human-name me --password text:hunter2","handlingStrategy":"validation","validationCode":"case \"$PW\" in text:*|fd:*|file:*) ;; *) echo \"--password must be type:value\"; exit 2;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Document the three accepted prefixes (text:, fd:, file:) next to every usage","Reject bare secrets in argument validators","Use file: for secrets containing colons"],"tags":["kitty","clipboard","cli-arguments","password-parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}