{"record":{"id":"e7b1457a21927ec3","repo":"glanceapp/glance","slug":"user-s-must-have-a-password-or-a-password-hash-se","errorCode":null,"errorMessage":"user %s must have a password or a password-hash set","messagePattern":"user (.+?) must have a password or a password-hash set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/config.go","lineNumber":473,"sourceCode":"\n\tif len(config.Auth.Users) > 0 && config.Auth.SecretKey == \"\" {\n\t\treturn fmt.Errorf(\"secret-key must be set when users are configured\")\n\t}\n\n\tfor username := range config.Auth.Users {\n\t\tif username == \"\" {\n\t\t\treturn fmt.Errorf(\"user has no name\")\n\t\t}\n\n\t\tif len(username) < 3 {\n\t\t\treturn errors.New(\"usernames must be at least 3 characters\")\n\t\t}\n\n\t\tuser := config.Auth.Users[username]\n\n\t\tif user.Password == \"\" {\n\t\t\tif user.PasswordHashString == \"\" {\n\t\t\t\treturn fmt.Errorf(\"user %s must have a password or a password-hash set\", username)\n\t\t\t}\n\t\t} else if len(user.Password) < 6 {\n\t\t\treturn fmt.Errorf(\"the password for %s must be at least 6 characters\", username)\n\t\t}\n\t}\n\n\tif config.Server.AssetsPath != \"\" {\n\t\tif _, err := os.Stat(config.Server.AssetsPath); os.IsNotExist(err) {\n\t\t\treturn fmt.Errorf(\"assets directory does not exist: %s\", config.Server.AssetsPath)\n\t\t}\n\t}\n\n\tfor i := range config.Pages {\n\t\tpage := &config.Pages[i]\n\n\t\tif page.Title == \"\" {\n\t\t\treturn fmt.Errorf(\"page %d has no name\", i+1)\n\t\t}","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/config.go#L455-L491","documentation":"A configured user has neither password nor password-hash set. Glance requires exactly one form of credential: a plaintext password (which it will hash) or a pre-computed password-hash (e.g. for deployments where secrets must not appear in plaintext).","triggerScenarios":"A user entry with a username but both password and password-hash omitted, or misnamed so both decode to empty strings. Note empty-string values count as unset.","commonSituations":"Intending to set the password via an env variable that is empty; typos like pass-word; forgetting the credential when adding a user; password-hash key misspelled.","solutions":["Add a password or a password-hash field to the user named in the message","If using variable expansion for the password, confirm the environment variable is non-empty","Check field spelling — password and password-hash are the accepted keys"],"exampleFix":"# before\n- username: alice\n# after\n- username: alice\n  password: ${GLANCE_ALICE_PASSWORD}\n# or pre-hashed:\n- username: alice\n  password-hash: $2y$10$...","handlingStrategy":"validation","validationCode":"for name, u := range cfg.Auth.Users {\n    if u.Password == \"\" && u.PasswordHashString == \"\" {\n        return fmt.Errorf(\"user %s lacks credentials\", name)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer password-hash entries for deployed configs (works even when env vars are empty)","Script user creation so username and credential are always paired"],"tags":["glance","auth","configuration"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}