{"record":{"id":"88d4a79e111473ea","repo":"caddyserver/caddy","slug":"plaintext-is-required","errorCode":null,"errorMessage":"plaintext is required","messagePattern":"plaintext is required","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddyhttp/caddyauth/command.go","lineNumber":138,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn caddy.ExitCodeFailedStartup, err\n\t\t\t}\n\n\t\t\tif !bytes.Equal(plaintext, confirmation) {\n\t\t\t\treturn caddy.ExitCodeFailedStartup, fmt.Errorf(\"password does not match\")\n\t\t\t}\n\t\t} else {\n\t\t\trd := bufio.NewReader(os.Stdin)\n\t\t\tplaintext, err = rd.ReadBytes('\\n')\n\t\t\tif err != nil {\n\t\t\t\treturn caddy.ExitCodeFailedStartup, err\n\t\t\t}\n\n\t\t\tplaintext = plaintext[:len(plaintext)-1] // Trailing newline\n\t\t}\n\n\t\tif len(plaintext) == 0 {\n\t\t\treturn caddy.ExitCodeFailedStartup, fmt.Errorf(\"plaintext is required\")\n\t\t}\n\t}\n\n\tvar hash []byte\n\tvar hashString string\n\tswitch algorithm {\n\tcase bcryptName:\n\t\thash, err = BcryptHash{cost: bcryptCost}.Hash(plaintext)\n\t\thashString = string(hash)\n\tcase argon2idName:\n\t\ttime, err := fs.GetUint32(\"argon2id-time\")\n\t\tif err != nil {\n\t\t\treturn caddy.ExitCodeFailedStartup, fmt.Errorf(\"failed to get argon2id time parameter: %w\", err)\n\t\t}\n\t\tmemory, err := fs.GetUint32(\"argon2id-memory\")\n\t\tif err != nil {\n\t\t\treturn caddy.ExitCodeFailedStartup, fmt.Errorf(\"failed to get argon2id memory parameter: %w\", err)\n\t\t}","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/caddyauth/command.go#L120-L156","documentation":"Guard in `caddy hash-password`: after reading the plaintext password (terminal or piped stdin), its length is zero, so there is nothing to hash. The faulty input is an empty password on stdin or an empty --plaintext value.","triggerScenarios":"Thrown at modules/caddyhttp/caddyauth/command.go:138 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide the plaintext password via --plaintext or when prompted by 'caddy hash-password'."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","contentChangedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}